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

Outbox Collection #593

Draft
wants to merge 94 commits into
base: trunk
Choose a base branch
from
Draft

Outbox Collection #593

wants to merge 94 commits into from

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Dec 8, 2023

Working on an Outbox Collection, to better support Blogs with lots of Followers, Retries and Activities other than Post.

/cc @mediaformat @Menrath @ruru4143 @akirk @mattwiebe

Proposed changes:

  • Add Outbox
  • Scheduler, that handles unpublished Outbox items in chunks
  • Implement Retry
  • Actions to push data into the Outbox

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Fixes #961.

@pfefferle pfefferle added this to the 2.0.0 milestone Dec 13, 2023
@pfefferle pfefferle removed this from the 2.0.0 milestone Dec 14, 2023
obenland added a commit that referenced this pull request Jan 15, 2025
Non-functional changes that split out the docs updates around users => actors from #593.
pfefferle and others added 4 commits January 15, 2025 15:42
* Outbox: Use post meta instead of taxonomies

* Add tests for meta values when adding Outbox items

* fix indents

---------

Co-authored-by: Matthias Pfefferle <[email protected]>
Copy link
Contributor

@mattwiebe mattwiebe left a comment

Choose a reason for hiding this comment

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

Haven't tried running this yet, but read through the changes and left a couple of comments/questions.

Really like the scheduler separation. 👍

What do we still need to do to ship this?


set_wp_object_state( $data, 'federate' );

$id = Outbox::add( $activity, $type, $user_id, $content_visibility );
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to me that all of this functionality in add_to_outbox should just live inside of Outbox::add? Which would then either leave us with a thin wrapper in this function, or we can then get rid of the wrapper entirely?

includes/scheduler/class-actor.php Outdated Show resolved Hide resolved
pfefferle and others added 6 commits January 16, 2025 23:34
* Update file name

* Extend WP_REST_Controller

* First pass at updated outbox endpoint

* Remove expectation of having cc in the response

* Update object type to be a bit more descriptive

* First pass at create endpoint

* Fix tests

* Get Activity Type from meta after #1173

* Fix rest_url_path

Props @pfefferle

* Return accurate number of outbox items

Props @pfefferle

* Add more tests and remove unnecessary out-of-bounds error

* Remove POST endpoint for now

We currently don't have a use-case for it.

* Limit Outbox by activity type and visibility

* Account for posts without visibility meta

Props @pfefferle

* phpcs

* Allow logged in users to see all activity types

* Add request context to remaining hooks

* Default query to limit activities

Adds an exception for requests with privileges.

* Slightly improve query
$args
);
}

Copy link
Member Author

@pfefferle pfefferle Jan 20, 2025

Choose a reason for hiding this comment

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

Suggested change
if ( 'Create' === $type && ACTIVITYPUB_CONTENT_VISIBILITY_PUBLIC && $content_visibility && ACTIVITYPUB_ACTOR_AND_BLOG_MODE === \get_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_MODE ) ) {
// @todo transform $data to announce
add_to_outbox( $data, 'Announce', Actors::BLOG_USER_ID );
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Would edits also need to be supported, or do those merely reference the original post? If so might we need to send those direct post updates to followers of the Blog Actor?

Copy link
Member Author

@pfefferle pfefferle Jan 20, 2025

Choose a reason for hiding this comment

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

you only share the id of a post via an Announce, so only Creates are important here... the updates will be done automatically afterwards... no need to re-announce them...

Copy link
Contributor

Choose a reason for hiding this comment

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

you only share the id of a post via an Announce, so only Creates are important

Perfect. But the further question:

Let's say I follow a WP example.com site from [email protected] with ACTIVITYPUB_ACTOR_AND_BLOG_MODE === true. I follow [email protected], but I don't follow [email protected]. I receive the Announce of a post by [email protected]. But the user then edits the post. Will mastodon.social get notified of the edit with nobody on the instance following [email protected]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Collections [Focus] Compatibility Ensuring the plugin plays well with other plugins [Status] In Progress [Type] Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleted WP post remains undeleted on Mastodon
3 participants