A platform for community discussion. Free, open, simple.
UX: display moderators group name in the group dropdown menu.
Vinoth Kannanba2f3119c0ba
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex ac6c8132f4a..273fe25c2b2 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -121,7 +121,9 @@ class GroupsController < ApplicationControllerformat.json dogroups = Group.visible_groups(current_user)- groups = groups.where(automatic: false) if !guardian.is_staff?+ if !guardian.is_staff?+ groups = groups.where("automatic IS FALSE OR groups.id = #{Group::AUTO_GROUPS[:moderators]}")+ endrender_json_dump(group: serialize_data(group, GroupShowSerializer, root: nil),diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex b122604f6c9..e8269fc6959 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -362,6 +362,7 @@ describe GroupsController doit "returns the right response" dosign_in(user)+ mod_group = Group.find(moderator_group_id)get "/groups/#{group.name}.json"expect(response.status).to eq(200)@@ -369,7 +370,7 @@ describe GroupsController dobody = response.parsed_bodyexpect(body['group']['id']).to eq(group.id)- expect(body['extras']["visible_group_names"]).to eq([group.name])+ expect(body['extras']["visible_group_names"]).to eq([mod_group.name, group.name])expect(response.headers['X-Robots-Tag']).to eq('noindex')end