FIX: Regression with finding reviewable counts on topics
This was a fairly serious regression on sites with large (mega) topics, however it was limited to staff. The issue here is the query was using filtered_post_ids which I'd assumed was already windowed to the current page, when in fact it was all the ids in the topic. This fix corrects it by using the correct windowed collection.
This commit is contained in:
parent
5e61893cb2
commit
f86a5bd5a9
|
@ -424,7 +424,7 @@ class TopicView
|
|||
# Create a hash with counts by post so we can quickly look up whether there is reviewable content.
|
||||
@reviewable_counts = {}
|
||||
Reviewable.
|
||||
where(target_type: 'Post', target_id: filtered_post_ids).
|
||||
where(target_type: 'Post', target_id: @posts.map(&:id)).
|
||||
includes(:reviewable_scores).each do |r|
|
||||
|
||||
for_post = (@reviewable_counts[r.target_id] ||= { total: 0, pending: 0, reviewable_id: r.id })
|
||||
|
|
Loading…
Reference in New Issue