Closed
Description
Steps to reproduce
- Empty your local moderation log
- Insert 51 - 99 moderation records
- Load http://localhost:3000/moderations
Expected result
Latest 50 moderation entries listed, with "Page 2" link at bottom of page to view remaining ones
Actual result
Latest 50 moderation entries listed, but no link to page 2 appears.
Adding page=2
to the params results in a routing error "page out of bounds".
Notes
This is reproducible with any number of pages too, so it's a permanent off-by-one error in the logic. eg, having 149 moderation entries only results in being able to view 149-99, 99-49. The final 49 entries that should be on page 3 are invisible.
I suspect our maths is wrong in the ModerationsController#index
action and we're working out the max page number to be 1 less than it should be, failing to account for the final (incomplete) page of entries.
Activity
pushcx commentedon Jan 13, 2025
Thanks for catching this. I still plan to rewrite pagination for #394 but it's worth fixing this.
This pagination logic is copied and pasted all over the codebase. It's possible there are more instances and it's possible this one is uniquely broken.
fix count of pages in ModerationsController lobsters#1433
fix count of pages in ModerationsController #1433