mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 00:58:43 +08:00
6ad34a0152
We want to exclude the system user from group user counts, since intuitively admins wouldn't include them. Originally this was accomplished by booting said system user from the groups, but this is causing problems, because the system user needs TL group membership to perform certain tasks. After this PR, system user is still in the TL groups, but excluded when refreshing the user count.
13 lines
331 B
Ruby
13 lines
331 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Jobs::RefreshUsersReviewableCounts < ::Jobs::Base
|
|
def execute(args)
|
|
group_ids = args[:group_ids]
|
|
return if group_ids.blank?
|
|
User
|
|
.human_users
|
|
.where(id: GroupUser.where(group_id: group_ids).distinct.select(:user_id))
|
|
.each(&:publish_reviewable_counts)
|
|
end
|
|
end
|