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

Merged
merged 136 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 117 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
5565c26
init
pfefferle Dec 8, 2023
7448cd6
outbox should not be public!
pfefferle Dec 8, 2023
6ac167f
add basic `to_activity` function
pfefferle Dec 11, 2023
704030c
Merge branch 'master' into add/outbox-collection
pfefferle Dec 11, 2023
89ece40
do not allow to instance post transformer
pfefferle Dec 11, 2023
0ba6d7b
Merge branch 'master' into add/outbox-collection
pfefferle Dec 12, 2023
efda4a5
fix tests
pfefferle Dec 12, 2023
1558551
Merge branch 'master' into add/outbox-collection
pfefferle Dec 13, 2023
6edc4b5
Merge branch 'master' into add/outbox-collection
pfefferle Dec 21, 2023
a38c565
Merge branch 'master' into add/outbox-collection
pfefferle Dec 22, 2023
2a3a6c3
Merge branch 'trunk' into add/outbox-collection
pfefferle Sep 27, 2024
5d66494
fix phpcs
pfefferle Sep 27, 2024
b1d260d
revert change
pfefferle Sep 27, 2024
81b0b88
remove unused `use` declarations
pfefferle Sep 27, 2024
8c0c3fa
the handler should not handle outgoing stuff
pfefferle Sep 27, 2024
3eb8ca6
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 22, 2024
43a3343
Update class-activitypub.php
pfefferle Oct 22, 2024
8746447
fix PHPCS
pfefferle Oct 22, 2024
242dea4
more PHPCS fixes
pfefferle Oct 22, 2024
f64aade
fix namespace issue
pfefferle Oct 22, 2024
5ca19a6
remove unneeded function
pfefferle Oct 22, 2024
9f525b0
fix sticky post endpoint
pfefferle Oct 22, 2024
e0aeefd
no need to check for User-ID
pfefferle Oct 22, 2024
2d3ba4b
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 23, 2024
1433e4f
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 23, 2024
943fc02
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 24, 2024
7f0a227
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 25, 2024
fb98bd2
Merge branch 'trunk' into add/outbox-collection
pfefferle Oct 26, 2024
945b335
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 5, 2024
9345991
support JSON and Arrays beside WP_Comments and WP_Posts
pfefferle Nov 5, 2024
d1e9839
fix auto-complete issue
pfefferle Nov 5, 2024
59ab8b9
simplify code.
pfefferle Nov 5, 2024
8133a1c
convert JSON to Activity_Object to not have everything duplicated
pfefferle Nov 5, 2024
0bdb30d
add support for maps and mentions
pfefferle Nov 5, 2024
593740f
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 7, 2024
748a266
it takes a string (JSON) or an array
pfefferle Nov 12, 2024
db789ff
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 13, 2024
22aea42
simplified based on the feedback of @obenland
pfefferle Nov 13, 2024
3648062
Merge branch 'add/outbox-collection' of https://github.com/Automattic…
pfefferle Nov 13, 2024
9b20505
rearrange code a bit
pfefferle Nov 14, 2024
617eff7
add missing uses
pfefferle Nov 14, 2024
ad5f35a
fix typo
pfefferle Nov 14, 2024
c1f63b5
add missing uses
pfefferle Nov 14, 2024
193ec0f
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 14, 2024
b00e64d
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 20, 2024
b005be7
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 20, 2024
726729f
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 20, 2024
ec9d389
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 21, 2024
37144b8
Merge branch 'trunk' into add/outbox-collection
pfefferle Nov 22, 2024
fe29ea4
Added Changelog-Entry
pfefferle Nov 22, 2024
5b31a6a
Merge branch 'trunk' into add/outbox-collection
pfefferle Dec 5, 2024
8f4f8b1
apply changes from @obenland
pfefferle Dec 6, 2024
f26eb3d
delay scheduling a bit
pfefferle Dec 6, 2024
77f8f06
change scheduling and add possibility to add items to outbox
pfefferle Dec 6, 2024
abef3dc
remove deprecated functions
pfefferle Dec 6, 2024
b93568d
add filter
pfefferle Dec 6, 2024
8d48752
Merge branch 'trunk' into add/outbox-collection
pfefferle Dec 6, 2024
17cc89b
fix indents
pfefferle Dec 6, 2024
535899c
removed deprecated functions
pfefferle Dec 6, 2024
9d8c270
add visibility and normalize autor id
pfefferle Dec 9, 2024
757c8c9
add taxonomies to store actor and actitiy-type informations
pfefferle Dec 11, 2024
400a70a
Merge branch 'trunk' into add/outbox-collection
pfefferle Dec 11, 2024
dd44ee2
Merge branch 'trunk' into add/outbox-collection
pfefferle Dec 11, 2024
451e339
Merge branch 'trunk' into add/outbox-collection
pfefferle Dec 17, 2024
9f81988
Merge branch 'trunk' into add/outbox-collection
obenland Jan 13, 2025
3fc94d3
Fix phpcs
obenland Jan 13, 2025
6589bed
Fix shortcode tests
obenland Jan 14, 2025
fad425e
Update json tests.
obenland Jan 14, 2025
a6e7190
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 15, 2025
1142be1
move map functions to base transformer
pfefferle Jan 15, 2025
1824b4b
use item instead of wp_object
pfefferle Jan 15, 2025
f9ca53d
protect functions
pfefferle Jan 15, 2025
58a84d9
fix tests and remove legacy tests
pfefferle Jan 15, 2025
c291d03
fix phpcs
pfefferle Jan 15, 2025
1aeb486
add unittests
pfefferle Jan 15, 2025
99a0a48
fix attachment issues and add tests
pfefferle Jan 15, 2025
5d89584
add tests for JSON transformer and fix detected problems
pfefferle Jan 15, 2025
8bea368
fix phpcs issues
pfefferle Jan 15, 2025
1c29caf
add activity-object transformer tests
pfefferle Jan 15, 2025
b654081
simplify code
pfefferle Jan 15, 2025
2077a01
define as global functions
pfefferle Jan 15, 2025
96d1146
re-added setter
pfefferle Jan 15, 2025
f028321
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 15, 2025
476250c
add content visibility
pfefferle Jan 16, 2025
511b422
fix PHPCS
pfefferle Jan 16, 2025
3720f30
Outbox: Use post meta instead of taxonomies (#1173)
obenland Jan 16, 2025
7e146bf
Update includes/scheduler/class-actor.php
pfefferle Jan 16, 2025
315493a
register content-visibility meta
pfefferle Jan 17, 2025
bb41713
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 20, 2025
a6cf6d9
Outbox: Update API Endpoint (#1170)
obenland Jan 20, 2025
aa88405
fix unittests
pfefferle Jan 20, 2025
4b2985b
Merge branch 'add/outbox-collection' of https://github.com/Automattic…
pfefferle Jan 20, 2025
8a7b5cc
pending seems to be the better status
pfefferle Jan 20, 2025
2d59047
Revert "pending seems to be the better status"
pfefferle Jan 20, 2025
38d8168
Merge branch 'trunk' into add/outbox-collection
mattwiebe Jan 21, 2025
b0810d0
Outbox: Use callbacks that can be unhooked. (#1188)
obenland Jan 22, 2025
d283db6
Outbox: Make sure Last page is linked correctly (#1195)
obenland Jan 22, 2025
0f1257c
Update includes/collection/class-outbox.php
pfefferle Jan 22, 2025
c28d03e
Update includes/collection/class-outbox.php
pfefferle Jan 22, 2025
4fd5642
Update includes/collection/class-outbox.php
pfefferle Jan 22, 2025
6bd1b80
fix type
pfefferle Jan 22, 2025
e0e9e13
Outbox: Fix Query (#1200)
pfefferle Jan 23, 2025
b1c8945
Fix typo
pfefferle Jan 23, 2025
bc6e7ed
Outbox: Tests and fixes for Post Scheduler (#1196)
obenland Jan 23, 2025
9bcf121
Update Dispatcher to use Outbox (#1186)
pfefferle Jan 23, 2025
32f0756
Outbox: Align return type and update docs (#1211)
obenland Jan 24, 2025
c02e6de
Outbox: Fix broken HTML tags after decoding Outbox items (#1212)
obenland Jan 24, 2025
fe8e966
Outbox: Fix race condition with Post-Metas (#1214)
pfefferle Jan 24, 2025
03ae03e
Outbox: Generalize functionality of the transformers (#1178)
pfefferle Jan 24, 2025
e041c92
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 27, 2025
adeb748
Update/testcases (#1215)
obenland Jan 27, 2025
40c9535
Outbox: Add upgrade script to populate outbox items (#1175)
obenland Jan 27, 2025
0dce338
Outbox: Fall back to blog author for non-authorized authors (#1208)
obenland Jan 27, 2025
081b905
Accept Follower: Migrate to outbox (#1205)
pfefferle Jan 27, 2025
cbcaea6
Send Activity and not its object (#1217)
obenland Jan 27, 2025
aa60f3f
Outbox: fix to_id function for user transformer (#1218)
pfefferle Jan 27, 2025
b95375a
Update class-test-outbox.php (#1220)
obenland Jan 27, 2025
02380de
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 28, 2025
f2b2097
Add hint where to find the visibility constants
pfefferle Jan 28, 2025
2d855cc
rename function to match new structure
pfefferle Jan 28, 2025
8453044
Outbox: Fix attachment transitions (#1219)
obenland Jan 28, 2025
2d99fd9
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 28, 2025
6041035
Outbox: Fix deletes (#1224)
pfefferle Jan 28, 2025
65e7d32
Outbox: Basic rescheduling (#1223)
pfefferle Jan 28, 2025
66007a5
Outbox: Publish item after processing (#1225)
obenland Jan 28, 2025
3ed9bcb
Outbox: Fix `to`, `cc` and `id` (#1226)
pfefferle Jan 28, 2025
97a76ee
Outbox: Register new event schedule on upgrade (#1228)
obenland Jan 28, 2025
395a90f
Outbox: Make post type non-hierarchical (#1227)
obenland Jan 28, 2025
821370d
Outbox: Fix profile updates (#1233)
pfefferle Jan 29, 2025
69453a1
Outbox: Account for transformer errors (#1231)
obenland Jan 29, 2025
86523f0
Outbox: Account for invalid json (#1230)
obenland Jan 29, 2025
987f21c
Merge branch 'trunk' into add/outbox-collection
pfefferle Jan 29, 2025
984b490
Outbox: Fix profile updates (#1236)
pfefferle Jan 29, 2025
dc21f97
Outbox: Federate blog user updates (#1237)
obenland Jan 30, 2025
a3487a0
Outbox: Show Outbox processing in Stream (#1229)
obenland Jan 30, 2025
36ca16c
Merge branch 'trunk' into add/outbox-collection
obenland Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Untitled]
## [Unreleased]

### Changed

Expand All @@ -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 Down
6 changes: 3 additions & 3 deletions activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
*/
function rest_init() {
Rest\Actors::init();
Rest\Outbox::init();
Rest\Inbox::init();
Rest\Followers::init();
Rest\Following::init();
Rest\Comment::init();
Rest\Server::init();
Rest\Collection::init();
Rest\Post::init();
( new Rest\Interaction_Controller() )->register_routes();
( new Rest\Application_Controller() )->register_routes();
( new Rest\Interaction_Controller() )->register_routes();
( new Rest\Outbox_Controller() )->register_routes();
( new Rest\Webfinger_Controller() )->register_routes();

// Load NodeInfo endpoints only if blog is public.
Expand All @@ -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
25 changes: 15 additions & 10 deletions includes/activity/class-base-object.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public function __call( $method, $params ) {
}

if ( \strncasecmp( $method, 'add', 3 ) === 0 ) {
$this->add( $var, $params[0] );
return $this->add( $var, $params[0] );
}
}

Expand Down Expand Up @@ -566,8 +566,17 @@ public function add( $key, $value ) {
$this->$key = array();
}

$attributes = $this->$key;
$attributes[] = $value;
if ( is_string( $this->$key ) ) {
$this->$key = array( $this->$key );
}

$attributes = $this->$key;

if ( is_array( $value ) ) {
$attributes = array_merge( $attributes, $value );
} else {
$attributes[] = $value;
}

$this->$key = $attributes;

Expand All @@ -585,7 +594,7 @@ public static function init_from_json( $json ) {
$array = \json_decode( $json, true );

if ( ! is_array( $array ) ) {
$array = array();
return new WP_Error( 'invalid_json', __( 'Invalid JSON', 'activitypub' ), array( 'status' => 400 ) );
}

return self::init_from_array( $array );
Expand All @@ -600,15 +609,11 @@ public static function init_from_json( $json ) {
*/
public static function init_from_array( $data ) {
if ( ! is_array( $data ) ) {
return new WP_Error( 'invalid_array', __( 'Invalid array', 'activitypub' ), array( 'status' => 404 ) );
return new WP_Error( 'invalid_array', __( 'Invalid array', 'activitypub' ), array( 'status' => 400 ) );
}

$object = new static();

foreach ( $data as $key => $value ) {
$key = camel_to_snake_case( $key );
call_user_func( array( $object, 'set_' . $key ), $value );
}
$object->from_array( $data );

return $object;
}
Expand Down
Loading
Loading