From 0a005c5e3dd34ce708788133b2af54629bcdbdfc Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 25 Aug 2018 09:31:03 -0400 Subject: [PATCH] Return 201 status from create_activity --- inc/outbox.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/outbox.php b/inc/outbox.php index 1154258..71d19e9 100644 --- a/inc/outbox.php +++ b/inc/outbox.php @@ -34,8 +34,13 @@ function create_activity( $actor, $activity ) { "actor" => $actor, "activity" => $activity_json, ) ); - return json_decode( $wpdb->get_var( sprintf( + $persisted = json_decode( $wpdb->get_var( sprintf( "SELECT activity FROM activitypub_outbox WHERE id = %d", $wpdb->insert_id ) ) ); + $response = new WP_REST_Response( $persisted ); + $response->set_status( 201 ); + // TODO set location header of response to created object URL + return $response; +} } ?>