mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 14:13:38 +08:00
PERF: Use pluck
instead of enmurating through all the records.
This commit is contained in:
parent
dd27c0c80e
commit
3e123b1a39
|
@ -68,11 +68,11 @@ class TopicView
|
||||||
|
|
||||||
if @posts
|
if @posts
|
||||||
if (added_fields = User.whitelisted_user_custom_fields(@guardian)).present?
|
if (added_fields = User.whitelisted_user_custom_fields(@guardian)).present?
|
||||||
@user_custom_fields = User.custom_fields_for_ids(@posts.map(&:user_id), added_fields)
|
@user_custom_fields = User.custom_fields_for_ids(@posts.pluck(:user_id), added_fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (whitelisted_fields = TopicView.whitelisted_post_custom_fields(@user)).present?
|
if (whitelisted_fields = TopicView.whitelisted_post_custom_fields(@user)).present?
|
||||||
@post_custom_fields = Post.custom_fields_for_ids(@posts.map(&:id), whitelisted_fields)
|
@post_custom_fields = Post.custom_fields_for_ids(@posts.pluck(:id), whitelisted_fields)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user