fix(blog): correct inverted last_page context value in blog_index#909
Open
SAY-5 wants to merge 1 commit intomemeLab:developfrom
Open
fix(blog): correct inverted last_page context value in blog_index#909SAY-5 wants to merge 1 commit intomemeLab:developfrom
SAY-5 wants to merge 1 commit intomemeLab:developfrom
Conversation
blog_index set `last_page` in the template context to `page.has_previous()`. has_previous() is True for every page except page 1, which is the opposite of what the variable name promises. The template uses last_page to stop the "load more" / end-of-feed path, so with the old value the feed appeared to reach the end as soon as the reader moved past page 1, even when more posts remained. Set last_page to `not page.has_next()` so it is True only once the user is actually on the final page. Fixes memeLab#857 Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
blog_indexinsrc/blog/views.pypopulateslast_pagein thetemplate context with
page.has_previous():Paginator.Page.has_previous()returnsTruewhenever there arepages before the current one — i.e., for every page except
page 1. The variable name promises the opposite:
last_pageshouldbe
Trueonly when the reader has reached the final page.Downstream templates use
last_pageto terminate the "load more"cycle / show an end-of-feed marker. With the old value the feed
appeared to end as soon as the reader clicked past page 1, regardless
of how many posts actually remained. #857.
Fix
Use the semantic opposite that actually matches the variable name:
page.has_next()returnsFalseonly on the final page, sonot page.has_next()isTrueexactly when the reader has reachedthe end of the feed.
Fixes #857