Skip to content

[OP-19967] Fix wiki_page_links pagination silently ignoring offset - #24774

Open
jtauschl wants to merge 2 commits into
opf:devfrom
jtauschl:fix/wiki-page-links-pagination-offset-ignored
Open

[OP-19967] Fix wiki_page_links pagination silently ignoring offset#24774
jtauschl wants to merge 2 commits into
opf:devfrom
jtauschl:fix/wiki-page-links-pagination-offset-ignored

Conversation

@jtauschl

@jtauschl jtauschl commented Aug 14, 2026

Copy link
Copy Markdown

Ticket

https://community.openproject.org/wp/OP-19967

Summary

Both the work-package-scoped and the global GET handlers only passed per_page: into PageLinkCollectionRepresenter.new, never page:. API::Decorators::OffsetPaginatedCollection defaults page to 1 whenever it's not explicitly given, so every request to either endpoint always rendered (and reported) page 1 of the underlying relation, silently ignoring the client's offset query parameter -- total was reported correctly, but offset itself always echoed back 1 and results never advanced past the first page.

Change

Pass params[:offset] through as page: at both call sites.

Test plan

  • Added regression request specs on both endpoints asserting the second page returns distinct elements from the first, and that offset is correctly reported
  • Verified live against a real 17.7.1 instance: before the fix, offset=2 returned the same elements as offset=1 on both endpoints; after the fix, each returns distinct, correct results independently

Both the work-package-scoped and the global GET handlers only passed
per_page: into PageLinkCollectionRepresenter.new, never page:.
API::Decorators::OffsetPaginatedCollection defaults page to 1 whenever
it's not explicitly given, so every request to either endpoint always
rendered (and reported) page 1 of the underlying relation, silently
ignoring the client's offset query parameter -- total was reported
correctly, but offset itself always echoed back 1 and results never
advanced past the first page.

Pass params[:offset] through as page: at both call sites.
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jtauschl

Copy link
Copy Markdown
Author

recheck

@myabc myabc changed the title Fix wiki_page_links pagination silently ignoring offset [OP-19967] Fix wiki_page_links pagination silently ignoring offset Aug 15, 2026
@myabc
myabc requested a lite review from Copilot August 15, 2026 18:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes API V3 pagination for wiki page links by ensuring the offset query parameter is actually applied when rendering WikiPageLinkCollection responses. It aligns the page-links endpoints with the expected behavior of API::Decorators::OffsetPaginatedCollection, which only paginates correctly when the current page is explicitly provided.

Changes:

  • Forward params[:offset] as page: into PageLinkCollectionRepresenter for the work-package-scoped endpoint.
  • Forward params[:offset] as page: into PageLinkCollectionRepresenter for the global endpoint.
  • Add request-spec regressions asserting offset=2&pageSize=2 returns a distinct second page and reports offset correctly for both endpoints.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
modules/wikis/spec/requests/api/v3/page_links/page_links_api_spec.rb Adds regression request specs ensuring pagination offset is applied and reported correctly on both endpoints.
modules/wikis/lib/api/v3/page_links/work_package_wiki_page_links_api.rb Fixes work-package-scoped endpoint by passing params[:offset] as page: to the collection representer.
modules/wikis/lib/api/v3/page_links/page_links_api.rb Fixes global endpoint by passing params[:offset] as page: to the collection representer.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

RSpecRails/HaveHttpStatus flagged the raw status-code comparison in the
two new pagination regression tests; have_http_status is this codebase's
established idiom, already used everywhere else in this same file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants