mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: topic_view participant post count: don't send back ID list (#10210)
On large topics, the cost of sending the entire post ID list back over to the database is signficant. Just have the DB recalculate the list of visible posts instead.
This commit is contained in:
@@ -287,7 +287,7 @@ describe TopicView do
|
||||
it 'returns the two posters with their appropriate counts' do
|
||||
Fabricate(:post, topic: topic, user: evil_trout, post_type: Post.types[:whisper])
|
||||
|
||||
expect(topic_view.post_counts_by_user.to_a).to match_array([[first_poster.id, 2], [evil_trout.id, 2]])
|
||||
expect(TopicView.new(topic.id, admin).post_counts_by_user.to_a).to match_array([[first_poster.id, 2], [evil_trout.id, 2]])
|
||||
|
||||
expect(TopicView.new(topic.id, first_poster).post_counts_by_user.to_a).to match_array([[first_poster.id, 2], [evil_trout.id, 1]])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user