Skip to content

Fix notification pagination#292

Merged
akirk merged 3 commits intomainfrom
fix-notifications-pagination
Apr 7, 2026
Merged

Fix notification pagination#292
akirk merged 3 commits intomainfrom
fix-notifications-pagination

Conversation

@akirk
Copy link
Copy Markdown
Owner

@akirk akirk commented Apr 7, 2026

Changes

mastodon_api_notifications_get filter — new optional arguments

Passes $limit, $before_date, and $after_date as additional arguments (3rd, 4th, 5th) to the filter. Backward compatible — existing two-argument handlers are unaffected.

This allows handlers to fetch only notifications within the current pagination window rather than fetching a fixed number from the top and truncating the shared pool. See the companion PR to the ActivityPub plugin (Automattic/wordpress-activitypub#3150) which uses these to fix pagination for reblog/like/follow notifications.

Test bootstrap — ap_outbox notice fix

Registers ap_outbox post type at init priority 0 so it is available before Migration::init() (priority 1) runs on fresh installs, preventing a doing_it_wrong notice during tests.

Test inject filter priority 5 → 50

The ActivityPub integration hooks into mastodon_api_notifications_get at priority 10 and was truncating the accumulated array to $limit before returning. Moving the test inject filter to priority 50 (after all real handlers, before finalize_notifications at 100) ensures the test pool is not clipped.

CI matrix — PHP 8.3, 8.4 and ActivityPub combination tests

Adds PHP 8.3 and 8.4 to the test matrix. Checks out the ActivityPub plugin as a sibling directory for PHP >= 8.1 so the combination is tested on CI.

akirk added 3 commits April 7, 2026 10:10
Pass $limit, $before_date, and $after_date as additional arguments to
the mastodon_api_notifications_get filter so handlers can fetch only the
relevant pagination window. Backward compatible — existing two-argument
handlers are unaffected.

Also register ap_outbox post type at init priority 0 in the test
bootstrap so it is available before Migration::init() (priority 1) runs,
preventing a doing_it_wrong notice on fresh installs.

Fixes test inject filter priority (5 → 50) so it runs after the
ActivityPub integration handler (priority 10), which was incorrectly
truncating the shared notification pool before finalize_notifications()
could paginate it.
Pass $limit, $before_date, and $after_date as additional arguments to
the mastodon_api_notifications_get filter so handlers can fetch only the
relevant pagination window. Backward compatible — existing two-argument
handlers are unaffected.

Also register ap_outbox post type at init priority 0 in the test
bootstrap so it is available before Migration::init() (priority 1) runs,
preventing a doing_it_wrong notice on fresh installs.

Move the test inject filter to priority 50 (after real handlers, before
finalize_notifications at 100) so it is not truncated by the ActivityPub
integration handler at priority 10.

Add PHP 8.3 and 8.4 to the CI matrix and check out the ActivityPub
plugin as a sibling for PHP >= 8.1 to test the combination.
@akirk akirk merged commit 7455b3f into main Apr 7, 2026
18 checks passed
@akirk akirk deleted the fix-notifications-pagination branch April 7, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant