mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 14:44:41 +08:00
PERF: Avoid fetching a bunch of ids in polls updater.
This commit is contained in:
@ -28,7 +28,7 @@ module DiscoursePoll
|
|||||||
end
|
end
|
||||||
|
|
||||||
# deal with option changes
|
# deal with option changes
|
||||||
if User.staff.pluck(:id).include?(post.last_editor_id)
|
if User.staff.where(id: post.last_editor_id).exists?
|
||||||
# staff can only edit options
|
# staff can only edit options
|
||||||
polls.each_key do |poll_name|
|
polls.each_key do |poll_name|
|
||||||
if polls[poll_name]["options"].size != previous_polls[poll_name]["options"].size && previous_polls[poll_name]["voters"].to_i > 0
|
if polls[poll_name]["options"].size != previous_polls[poll_name]["options"].size && previous_polls[poll_name]["voters"].to_i > 0
|
||||||
|
Reference in New Issue
Block a user