disable broken delete activity

This commit is contained in:
Matthias Pfefferle 2019-11-27 08:25:04 +01:00
parent 9a4c9768f2
commit 937618101e
3 changed files with 9 additions and 11 deletions

View file

@ -15,7 +15,7 @@ class Activity_Dispatcher {
public static function init() { public static function init() {
\add_action( 'activitypub_send_post_activity', array( '\Activitypub\Activity_Dispatcher', 'send_post_activity' ) ); \add_action( 'activitypub_send_post_activity', array( '\Activitypub\Activity_Dispatcher', 'send_post_activity' ) );
\add_action( 'activitypub_send_update_activity', array( '\Activitypub\Activity_Dispatcher', 'send_update_activity' ) ); \add_action( 'activitypub_send_update_activity', array( '\Activitypub\Activity_Dispatcher', 'send_update_activity' ) );
\add_action( 'activitypub_send_delete_activity', array( '\Activitypub\Activity_Dispatcher', 'send_delete_activity' ) ); // \add_action( 'activitypub_send_delete_activity', array( '\Activitypub\Activity_Dispatcher', 'send_delete_activity' ) );
} }
/** /**

View file

@ -24,8 +24,6 @@ class Activitypub {
} }
\add_action( 'transition_post_status', array( '\Activitypub\Activitypub', 'schedule_post_activity' ), 10, 3 ); \add_action( 'transition_post_status', array( '\Activitypub\Activitypub', 'schedule_post_activity' ), 10, 3 );
\add_action( 'trash_post', array( '\Activitypub\Activitypub', 'schedule_delete_activity' ), 10 );
} }
/** /**

View file

@ -90,15 +90,15 @@ class Inbox {
$data = \json_decode( $request->get_body(), true ); $data = \json_decode( $request->get_body(), true );
if ( ! \is_array( $data ) || ! \array_key_exists( 'type', $data ) ) {
return new \WP_Error( 'rest_invalid_data', \__( 'Invalid payload', 'activitypub' ), array( 'status' => 422 ) );
}
$type = 'create'; $type = 'create';
if ( ! empty( $data['type'] ) ) { if ( ! empty( $data['type'] ) ) {
$type = \strtolower( $data['type'] ); $type = \strtolower( $data['type'] );
} }
if ( ! \is_array( $data ) || ! \array_key_exists( 'type', $data ) ) {
return new \WP_Error( 'rest_invalid_data', \__( 'Invalid payload', 'activitypub' ), array( 'status' => 422 ) );
}
\do_action( 'activitypub_inbox', $data, $author_id, $type ); \do_action( 'activitypub_inbox', $data, $author_id, $type );
\do_action( "activitypub_inbox_{$type}", $data, $author_id ); \do_action( "activitypub_inbox_{$type}", $data, $author_id );
@ -155,15 +155,15 @@ class Inbox {
$author_id = $author->ID; $author_id = $author->ID;
} }
if ( ! \is_array( $data ) || ! \array_key_exists( 'type', $data ) ) {
return new \WP_Error( 'rest_invalid_data', \__( 'Invalid payload', 'activitypub' ), array( 'status' => 422 ) );
}
$type = 'create'; $type = 'create';
if ( ! empty( $data['type'] ) ) { if ( ! empty( $data['type'] ) ) {
$type = \strtolower( $data['type'] ); $type = \strtolower( $data['type'] );
} }
if ( ! \is_array( $data ) || ! \array_key_exists( 'type', $data ) ) {
return new \WP_Error( 'rest_invalid_data', \__( 'Invalid payload', 'activitypub' ), array( 'status' => 422 ) );
}
\do_action( 'activitypub_inbox', $data, $author_id, $type ); \do_action( 'activitypub_inbox', $data, $author_id, $type );
\do_action( "activitypub_inbox_{$type}", $data, $author_id ); \do_action( "activitypub_inbox_{$type}", $data, $author_id );