Fix miscellaneous issues
This commit is contained in:
parent
8e283ac652
commit
72375b017b
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
);
|
||||
"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user