mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Force summary mode when user enters at the top of megalodoon topics.
This commit is contained in:
@@ -365,22 +365,31 @@ describe TopicView do
|
||||
end
|
||||
|
||||
describe 'when a megalodon topic is closed' do
|
||||
before do
|
||||
@original_const = TopicView::MEGA_TOPIC_POSTS_COUNT
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", 1)
|
||||
topic.update!(closed: true)
|
||||
SiteSetting.summary_max_results = 2
|
||||
end
|
||||
|
||||
after do
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", @original_const)
|
||||
end
|
||||
|
||||
it 'should be forced into summary mode without gaps' do
|
||||
begin
|
||||
original_const = TopicView::MEGA_TOPIC_POSTS_COUNT
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", 1)
|
||||
SiteSetting.summary_max_results = 2
|
||||
topic.update!(closed: true)
|
||||
topic_view = TopicView.new(topic.id, evil_trout, post_number: 1)
|
||||
|
||||
topic_view = TopicView.new(topic.id, evil_trout)
|
||||
expect(topic_view.contains_gaps?).to eq(false)
|
||||
expect(topic_view.posts).to eq([p5])
|
||||
end
|
||||
|
||||
expect(topic_view.contains_gaps?).to eq(false)
|
||||
expect(topic_view.posts).to eq([p5])
|
||||
ensure
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", original_const)
|
||||
end
|
||||
it 'should not be forced into summary mode if post_number is not blank' do
|
||||
topic_view = TopicView.new(topic.id, evil_trout, post_number: 2)
|
||||
|
||||
expect(topic_view.contains_gaps?).to eq(false)
|
||||
expect(topic_view.posts).to eq([p1, p2, p3])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user