FIX: One-by-off error in topic show action (#13183)

The not found condition did not work for topics with chunk_size posts,
because it considered it has two pages, but it only has one.
This commit is contained in:
Bianca Nenciu
2021-05-28 11:36:45 +03:00
committed by GitHub
parent 501de809da
commit c247776c65
2 changed files with 23 additions and 1 deletions

View File

@ -128,7 +128,7 @@ class TopicsController < ApplicationController
end
page = params[:page]
if (page < 0) || ((page - 1) * @topic_view.chunk_size > @topic_view.topic.highest_post_number)
if (page < 0) || ((page - 1) * @topic_view.chunk_size >= @topic_view.topic.highest_post_number)
raise Discourse::NotFound
end