mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: don't show members of a group in the user summary
This commit is contained in:
parent
4b036bb7bf
commit
b09ee9cb82
1 changed files with 10 additions and 8 deletions
|
@ -66,14 +66,17 @@ class TopicViewSerializer < ApplicationSerializer
|
|||
}
|
||||
|
||||
if object.topic.private_message?
|
||||
result[:allowed_users] = object.topic.allowed_users.map do |user|
|
||||
BasicUserSerializer.new(user, scope: scope, root: false)
|
||||
end
|
||||
end
|
||||
allowed_user_ids = Set.new
|
||||
|
||||
if object.topic.private_message?
|
||||
result[:allowed_groups] = object.topic.allowed_groups.map do |ag|
|
||||
BasicGroupSerializer.new(ag, scope: scope, root: false)
|
||||
result[:allowed_groups] = object.topic.allowed_groups.map do |group|
|
||||
allowed_user_ids.merge(GroupUser.where(group: group).pluck(:user_id))
|
||||
BasicGroupSerializer.new(group, scope: scope, root: false)
|
||||
end
|
||||
|
||||
result[:allowed_users] = object.topic.allowed_users.select do |user|
|
||||
!allowed_user_ids.include?(user.id)
|
||||
end.map do |user|
|
||||
BasicUserSerializer.new(user, scope: scope, root: false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -83,7 +86,6 @@ class TopicViewSerializer < ApplicationSerializer
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
if object.suggested_topics.try(:topics).present?
|
||||
result[:suggested_topics] = object.suggested_topics.topics.map do |user|
|
||||
SuggestedTopicSerializer.new(user, scope: scope, root: false)
|
||||
|
|
Loading…
Reference in a new issue