From 2bc88946858c7ac0e759ae1a99fba9906b357279 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 4 Sep 2018 22:21:08 -0600 Subject: [PATCH] Implement wrap_object_in_create --- inc/outbox.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/inc/outbox.php b/inc/outbox.php index 8d0aa3a..39f895d 100644 --- a/inc/outbox.php +++ b/inc/outbox.php @@ -71,6 +71,9 @@ function handle_activity( $actor, $activity ) { break; default: $create_activity = wrap_object_in_create( $activity ); + if ( is_wp_error( $create_activity ) ) { + return $create_activity; + } $activity = \activities\create\handle( $actor, $create_activity ); break; } @@ -101,8 +104,18 @@ function persist_activity( $actor, $activity ) { return $response; } -function wrap_object_in_create( $object ) { - // TODO +function wrap_object_in_create( $actor_slug, $object ) { + $actor = \actors\get_actor_by_slug( $actor_slug ); + if ( is_wp_error( $actor ) ) { + return $actor; + } + $activity = array( + '@context' => 'https://www.w3.org/ns/activitystreams', + 'type' => 'Create', + 'actor' => $actor, + 'object' => $object + ); + return $activity; } function create_outbox_table() {