mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 04:33:38 +08:00
UX: display moderators group name in the group dropdown menu.
This commit is contained in:
@ -121,7 +121,9 @@ class GroupsController < ApplicationController
|
|||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
groups = Group.visible_groups(current_user)
|
groups = 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]}")
|
||||||
|
end
|
||||||
|
|
||||||
render_json_dump(
|
render_json_dump(
|
||||||
group: serialize_data(group, GroupShowSerializer, root: nil),
|
group: serialize_data(group, GroupShowSerializer, root: nil),
|
||||||
|
@ -362,6 +362,7 @@ describe GroupsController do
|
|||||||
|
|
||||||
it "returns the right response" do
|
it "returns the right response" do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
|
mod_group = Group.find(moderator_group_id)
|
||||||
get "/groups/#{group.name}.json"
|
get "/groups/#{group.name}.json"
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
@ -369,7 +370,7 @@ describe GroupsController do
|
|||||||
body = response.parsed_body
|
body = response.parsed_body
|
||||||
|
|
||||||
expect(body['group']['id']).to eq(group.id)
|
expect(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')
|
expect(response.headers['X-Robots-Tag']).to eq('noindex')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user