mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Don't display days ago on timeline for megatopics.
Analysis using `pg_stat_statements` showed this query to be eating up a significant portion of CPU.
This commit is contained in:
@@ -549,4 +549,30 @@ describe TopicView do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#filtered_post_stream' do
|
||||
let!(:post) { Fabricate(:post, topic: topic, user: first_poster) }
|
||||
let!(:post2) { Fabricate(:post, topic: topic, user: evil_trout) }
|
||||
let!(:post3) { Fabricate(:post, topic: topic, user: first_poster) }
|
||||
|
||||
it 'should return the right columns' do
|
||||
expect(topic_view.filtered_post_stream).to eq([
|
||||
[post.id, post.post_number, 0],
|
||||
[post2.id, post2.post_number, 0],
|
||||
[post3.id, post3.post_number, 0]
|
||||
])
|
||||
end
|
||||
|
||||
describe 'for mega topics' do
|
||||
it 'should return the right columns' do
|
||||
SiteSetting.auto_close_topics_post_count = 2
|
||||
|
||||
expect(topic_view.filtered_post_stream).to eq([
|
||||
[post.id, post.post_number],
|
||||
[post2.id, post2.post_number],
|
||||
[post3.id, post3.post_number]
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user