Fix miscellaneous issues

This commit is contained in:
Jeremy Dormitzer 2018-08-29 17:04:24 -04:00
parent 8e283ac652
commit 72375b017b
4 changed files with 8 additions and 6 deletions

View File

@ -11,7 +11,7 @@ function get_activity( $id ) {
'not_found', __( 'Activity not found', 'activitypub' ), array( 'status' => 404 )
);
}
$activity = json_decode( $activity_json );
$activity = json_decode( $activity_json, true );
$activity['id'] = get_activity_url( $id );
return $activity;
}

View File

@ -14,7 +14,7 @@ function get_actor( $request ) {
function post_to_outbox( $request ) {
$actor = $request['actor'];
$activity = json_decode( $request->get_body() );
$activity = json_decode( $request->get_body(), true );
return \outbox\handle_activity( $actor, $activity );
}

View File

@ -18,7 +18,7 @@ function get_object( $id ) {
404, __( 'Object not found', 'activitypub' ), array ( 'status' => 404 )
);
}
$object = json_decode( $object_json );
$object = json_decode( $object_json, true );
$object['id'] = get_object_url( $id );
return $object;
}

View File

@ -25,7 +25,7 @@ function handle_activity( $actor, $activity ) {
}
switch ( $activity['type'] ) {
case 'Create':
$activity = \activites\create\handle( $actor, $activity );
$activity = \activities\create\handle( $actor, $activity );
break;
case 'Update':
break;
@ -68,7 +68,7 @@ function persist_activity( $actor, $activity ) {
'actor' => $actor,
'activity_id' => $activity_id,
) );
$response = new WP_REST_Response();
$response = new \WP_REST_Response();
$response->set_status( 201 );
$response->header( 'Location', $activity['id'] );
return $response;
@ -81,7 +81,9 @@ function create_outbox_table() {
CREATE TABLE IF NOT EXISTS activitypub_outbox (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
actor VARCHAR(128) NOT NULL,
activity_id INT UNSIGNED FOREIGN KEY REFERENCES activitypub_activities(id)
activity_id INT UNSIGNED NOT NULL,
FOREIGN KEY activity_fk(activity_id)
REFERENCES activitypub_activities(id)
);
"
);