mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: calculate page if page param is not given to TopicView (#10953)
Currently, when page param is not given to TopicView we calculate page for canonical_path, however, it is skipped for next_path. We should use the same calculation to define page, so next page URL will be accurate. Currently if you [view source of meta post](view-source:https://meta.discourse.org/t/post-rate-limit-trigger-for-a-topic-thats-heating-up/98294/46) you will see: ``` <link rel="canonical" href="https://meta.discourse.org/t/post-rate-limit-trigger-for-a-topic-thats-heating-up/98294?page=3" /> <link rel="next" href="/t/post-rate-limit-trigger-for-a-topic-thats-heating-up/98294?page=2"> ```
This commit is contained in:
committed by
GitHub
parent
f84261b530
commit
2ad4fc39b6
@@ -273,13 +273,15 @@ describe TopicView do
|
||||
let!(:post) { Fabricate(:post, topic: topic, user: user) }
|
||||
let!(:post2) { Fabricate(:post, topic: topic, user: user) }
|
||||
let!(:post3) { Fabricate(:post, topic: topic, user: user) }
|
||||
let!(:post4) { Fabricate(:post, topic: topic, user: user) }
|
||||
let!(:post5) { Fabricate(:post, topic: topic, user: user) }
|
||||
|
||||
before do
|
||||
TopicView.stubs(:chunk_size).returns(2)
|
||||
end
|
||||
|
||||
it "should return the next page" do
|
||||
expect(TopicView.new(topic.id, user).next_page).to eql(2)
|
||||
expect(TopicView.new(topic.id, user, { post_number: post.post_number }).next_page).to eql(3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user