Enable Mastodon Apps: Add tags.pub integration for tag timelines#3151
Merged
Enable Mastodon Apps: Add tags.pub integration for tag timelines#3151
Conversation
3 tasks
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds tags.pub enrichment to Mastodon tag timelines by fetching and resolving remote Announce activities into additional statuses, with short-term caching.
Changes:
- Add a
mastodon_api_tag_timelinefilter to append remote statuses from tags.pub. - Implement outbox fetch + Announce resolution (original object + author actor) using existing conversion helpers.
- Cache successful results for 15 minutes and failures for 5 minutes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| integration/class-enable-mastodon-apps.php | Implements tags.pub fetching/resolution and merges remote statuses into tag timeline responses with caching. |
| .github/changelog/3151-from-description | Adds changelog entry for the new feature. |
Fetch the outbox of tags.pub actors (e.g. @WordPress@tags.pub) to supplement tag timelines with posts from across the Fediverse. Each Announce activity is resolved to its original post and converted to a Mastodon API Status entity using the existing activity_to_status() and get_account_for_actor() methods. Results are cached for 15 minutes. The batch size is capped at 5 items regardless of client-requested limit since each item requires multiple HTTP round-trips to resolve. See: https://activitypub.blog/2026/04/02/discover-more-of-the-fediverse-with-tags-pub/
Pass the ap_actor post ID directly to actor_to_account() instead of relying on Actor::get__id(), which returns null for remote actors because the Actor base class does not declare the $_id property. This avoids falling back to URI strings that then get remapped via the EMA remap taxonomy.
- Fix extra spaces in api_status_by_url docblock param alignment - Use apply_filters instead of direct method call in api_search_by_url so third-party plugins can hook into mastodon_api_status_by_url
f5298b2 to
cb9de8c
Compare
Member
|
@akirk can you address the co-pilot concerns? |
Storing Status objects in transients is brittle — PHP object serialization can break across deployments when classes change. Cache the resolved ActivityPub data (plain arrays with 'object' and 'actor_uri' keys) and build Status entities fresh on each read via the existing activity_to_status() pipeline.
The mastodon_api_tag_timeline filter receives and returns Status[], not WP_REST_Response. Remove the unnecessary WP_REST_Response handling and instanceof checks.
The mastodon_api_tag_timeline filter actually receives a WP_REST_Response (from EMA's get_posts()), not Status[]. Handle this correctly and preserve the response object.
Member
Author
|
Oh, I missed that. Addressed! |
When merging local and tags.pub statuses, the same post could appear in both sources, producing duplicate IDs that crash Tusky's LazyColumn.
- Fix alignment warning for $seen variable. - Make tags.pub base URL filterable via activitypub_tags_pub_base_url. - Add defensive type check in sort callback to prevent fatal errors when merged items are not Status objects.
pfefferle
approved these changes
Apr 9, 2026
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.
Summary
This will allow to view tags from inside a Mastodon app.
Proposed changes:
@wordpress@tags.pub), resolve Announce activities to their original posts, and convert them to Mastodon API Status entitiesactivity_to_status()andget_account_for_actor()methodsOther information:
Testing instructions:
#wordpress) and verify remote posts from tags.pub appearChangelog entry
Changelog Entry Details
Significance
Type
Message
Enable Mastodon Apps: Add tags.pub integration to supplement tag timelines with posts from across the Fediverse.