mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
PERF: Only show members count on group page.
This commit is contained in:
@ -7,23 +7,6 @@ class GroupsController < ApplicationController
|
||||
render_serialized(find_group(:id), GroupShowSerializer, root: 'basic_group')
|
||||
end
|
||||
|
||||
def counts
|
||||
group = find_group(:group_id)
|
||||
|
||||
counts = {
|
||||
posts: group.posts_for(guardian).count,
|
||||
topics: group.posts_for(guardian).where(post_number: 1).count,
|
||||
mentions: group.mentioned_posts_for(guardian).count,
|
||||
members: group.users.count,
|
||||
}
|
||||
|
||||
if guardian.can_see_group_messages?(group)
|
||||
counts[:messages] = group.messages_for(guardian).where(post_number: 1).count
|
||||
end
|
||||
|
||||
render json: { counts: counts }
|
||||
end
|
||||
|
||||
def posts
|
||||
group = find_group(:group_id)
|
||||
posts = group.posts_for(guardian, params[:before_post_id]).limit(20)
|
||||
|
Reference in New Issue
Block a user