Skip to content

Moderations pagination never shows the final page of results #1433

Closed
@caius

Description

@caius

Steps to reproduce

  1. Empty your local moderation log
  2. Insert 51 - 99 moderation records
  3. 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

changed the title Moderations pagination never lets you view the final page of the log (off by one error) Moderations pagination never shows the final page of results on Jan 12, 2025
pushcx

pushcx commented on Jan 13, 2025

@pushcx
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Moderations pagination never shows the final page of results · Issue #1433 · lobsters/lobsters