Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActivityPub Query: Improve third party plugin support #1272

Merged
merged 10 commits into from
Feb 5, 2025

Conversation

pfefferle
Copy link
Member

  • Add filter to change the queried object
  • Always call transformer

See #1263

@pfefferle pfefferle requested a review from obenland February 5, 2025 09:23
@pfefferle pfefferle self-assigned this Feb 5, 2025
@pfefferle pfefferle added the [Focus] Compatibility Ensuring the plugin plays well with other plugins label Feb 5, 2025
@Menrath
Copy link
Contributor

Menrath commented Feb 5, 2025

Either this or we could also introduce a query like ?t=<term_id> for ActivityPub requests. This would kind of unify behaviour for third party plugins and maybe reduce the possibility of errors.

But the approach here is indeed useful for some cases: I have already real life examples in mind:

Some event plugins have "events" and "event occurances". Usually the occurances are stored in a custom table, because the posts table is just not adequate for such special cases. This is also what "The Events Calendar" and "GatherPress" do.

With that filter one could easily set an "occurance" as the targeted query, which would not be possible (in an easy and straight-forward way) without the filter I would guess.

Edit: Maybe that example is not good, because the custom transformer might be able to negotiate that, if the related WP_Post object gets "identified" as the queried object by WordPress.

@obenland
Copy link
Member

obenland commented Feb 5, 2025

What would be a good way for me to test this change? Go to an author archive page?

@pfefferle
Copy link
Member Author

this handles the content negotiation for authors, posts, comments and all other post-types. so you can check this by calling one or all of these sites with the application/json+activity Accept header.

@pfefferle
Copy link
Member Author

Ah and adding the query bar was only to get sure that we have access to it!

@pfefferle pfefferle merged commit 32eead9 into trunk Feb 5, 2025
11 checks passed
@pfefferle pfefferle deleted the improve/query-usage branch February 5, 2025 13:49
Menrath pushed a commit to Menrath/wordpress-activitypub that referenced this pull request Feb 6, 2025
* check `$activitypub_object` before returning it

* make queried object filterable

* add phpdoc

* added changelog

* Fix phpcs issues

* allow access to `author`

---------

Co-authored-by: Konstantin Obenland <obenland@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Compatibility Ensuring the plugin plays well with other plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants