Skip to content

Commit

Permalink
Update Dispatcher to use Outbox (#1186)
Browse files Browse the repository at this point in the history
* rename dispatcher

* Simple dispatcher based on the Outbox-Collection

This is a simple rewrite of the current dispatcher system, to use the Outbox instead of the Scheduler.

This is a first draft and will be improved over time, to better handle:

* Re-tries
* Errors
* Logging
* Batch processing

* update changelog

* mark post as `publish` after federation id done

* show only published activities

* fix missing rename

* use pending instead of draft

* do not check for post_status

* fix tests

props @obenland

* Send `Update`s to Blog Actor in dual mode

* Update includes/class-dispatcher.php

Co-authored-by: Konstantin Obenland <[email protected]>

* Update includes/class-dispatcher.php

Co-authored-by: Konstantin Obenland <[email protected]>

* Update includes/rest/class-outbox-controller.php

Co-authored-by: Konstantin Obenland <[email protected]>

* Check if Activity should be sent to followers

* the unique check will be done `send_activity_to_followers`

* fix tests

* fix PHPCS

* move scheduler behind action

* Add `private` visibility

* Add Announce activity

* Announce the full object!

* fix indent

* Update includes/transformer/class-base.php

Co-authored-by: Konstantin Obenland <[email protected]>

* add doc-block

* only boost content not profile updates

* Also handle `Delete` when bundling Blog Actor inboxes

* Update docs

* Avoid activitypub_actor_mode bleeding into other tests

* Fix comments tests

* Account for inheritance in Activity objects

* Move hook to the right place

* fix typo!

* trigger scheduler

* Fix tests

---------

Co-authored-by: Matt Wiebe <[email protected]>
Co-authored-by: Konstantin Obenland <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2025
1 parent bc6e7ed commit 9bcf121
Show file tree
Hide file tree
Showing 19 changed files with 491 additions and 378 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Support for WPML post locale

### Added

* Outbox queue

### Changed

* Rewrite the current dispatcher system, to use the Outbox instead of the Scheduler.

### Removed

* Built-in support for nodeinfo2. Use the [NodeInfo plugin](https://wordpress.org/plugins/nodeinfo/) instead.
Expand All @@ -42,7 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Outbox queue
* Comment counts get updated when the plugin is activated/deactivated/deleted
* Added a filter to make custom comment types manageable in WP.com Calypso

Expand Down
2 changes: 1 addition & 1 deletion activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function rest_init() {
function plugin_init() {
\add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Activitypub', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Activity_Dispatcher', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Dispatcher', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Handler', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Admin', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Hashtag', 'init' ) );
Expand Down
348 changes: 0 additions & 348 deletions includes/class-activity-dispatcher.php

This file was deleted.

2 changes: 1 addition & 1 deletion includes/class-activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ private static function register_post_types() {
'sanitize_callback' => function ( $value ) {
$schema = array(
'type' => 'string',
'enum' => array( ACTIVITYPUB_CONTENT_VISIBILITY_PUBLIC, ACTIVITYPUB_CONTENT_VISIBILITY_QUIET_PUBLIC, ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL ),
'enum' => array( ACTIVITYPUB_CONTENT_VISIBILITY_PUBLIC, ACTIVITYPUB_CONTENT_VISIBILITY_QUIET_PUBLIC, ACTIVITYPUB_CONTENT_VISIBILITY_PRIVATE, ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL ),
'default' => ACTIVITYPUB_CONTENT_VISIBILITY_PUBLIC,
);

Expand Down
Loading

0 comments on commit 9bcf121

Please sign in to comment.