UX: Do not display non-human users on group page.

https://meta.discourse.org/t/members-of-groups-staff/71437
This commit is contained in:
Guo Xiang Tan 2017-10-06 10:35:40 +08:00
parent a88f910469
commit 3efde2618d
2 changed files with 8 additions and 4 deletions

View File

@ -125,15 +125,17 @@ class GroupsController < ApplicationController
order = "#{params[:order]} #{dir} NULLS LAST" order = "#{params[:order]} #{dir} NULLS LAST"
end end
total = group.users.count users = group.users.human_users
members = group.users
total = users.count
members = users
.order('NOT group_users.owner') .order('NOT group_users.owner')
.order(order) .order(order)
.order(username_lower: dir) .order(username_lower: dir)
.limit(limit) .limit(limit)
.offset(offset) .offset(offset)
owners = group.users owners = users
.order(order) .order(order)
.order(username_lower: dir) .order(username_lower: dir)
.where('group_users.owner') .where('group_users.owner')

View File

@ -183,7 +183,9 @@ describe GroupsController do
) )
end end
let(:group) { Fabricate(:group, users: [user1, user2, user3]) } let(:bot) { Fabricate(:user, id: -999) }
let(:group) { Fabricate(:group, users: [user1, user2, user3, bot]) }
it "should allow members to be sorted by" do it "should allow members to be sorted by" do
get "/groups/#{group.name}/members.json", params: { get "/groups/#{group.name}/members.json", params: {