mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
PERF: avoid needless queries on non private messages
This commit is contained in:
parent
e5c5744dd5
commit
722e1fc4d0
1 changed files with 2 additions and 2 deletions
|
@ -65,13 +65,13 @@ class TopicViewSerializer < ApplicationSerializer
|
|||
last_poster: BasicUserSerializer.new(object.topic.last_poster, scope: scope, root: false)
|
||||
}
|
||||
|
||||
if object.topic.allowed_users.present?
|
||||
if object.topic.private_message?
|
||||
result[:allowed_users] = object.topic.allowed_users.map do |user|
|
||||
BasicUserSerializer.new(user, scope: scope, root: false)
|
||||
end
|
||||
end
|
||||
|
||||
if object.topic.allowed_groups.present?
|
||||
if object.topic.private_message?
|
||||
result[:allowed_groups] = object.topic.allowed_groups.map do |ag|
|
||||
BasicGroupSerializer.new(ag, scope: scope, root: false)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue