| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Activitypub\Handler; |
| 9 | 9 | |
| 10 | -use Activitypub\Collection\Inbox; | |
| 11 | 10 | use Activitypub\Collection\Interactions; |
| 12 | 11 | use Activitypub\Collection\Remote_Actors; |
| 13 | 12 | use Activitypub\Collection\Remote_Posts; |
| 14 | 13 | use Activitypub\Tombstone; |
| @@ -22,10 +21,9 @@ | ||
| 22 | 21 | /** |
| 23 | 22 | * Initialize the class, registering WordPress hooks. |
| 24 | 23 | */ |
| 25 | 24 | public static function init() { |
| 26 | - \add_action( 'activitypub_inbox_delete', array( self::class, 'handle_delete' ), 10, 4 ); | |
| 27 | - \add_action( 'activitypub_inbox_shared_delete', array( self::class, 'handle_delete' ), 10, 4 ); | |
| 25 | + \add_action( 'activitypub_inbox_delete', array( self::class, 'handle_delete' ), 10, 2 ); | |
| 28 | 26 | \add_filter( 'activitypub_skip_inbox_storage', array( self::class, 'skip_inbox_storage' ), 10, 2 ); |
| 29 | 27 | \add_filter( 'activitypub_defer_signature_verification', array( self::class, 'defer_signature_verification' ), 10, 3 ); |
| 30 | 28 | \add_action( 'activitypub_delete_remote_actor_interactions', array( self::class, 'delete_interactions' ) ); |
| 31 | 29 | \add_action( 'activitypub_delete_remote_actor_posts', array( self::class, 'delete_posts' ) ); |
| @@ -36,20 +34,12 @@ | ||
| 36 | 34 | |
| 37 | 35 | /** |
| 38 | 36 | * Handles "Delete" requests. |
| 39 | 37 | * |
| 40 | - * @param array $activity The delete activity. | |
| 41 | - * @param int|int[] $user_ids The local user ID(s). | |
| 42 | - * @param \Activitypub\Activity\Activity|null $activity_object Optional. The activity object. Default null. | |
| 43 | - * @param string|null $context Optional. The inbox context. Default null. | |
| 38 | + * @param array $activity The delete activity. | |
| 39 | + * @param int|int[] $user_ids The local user ID(s). | |
| 44 | 40 | */ |
| 45 | - public static function handle_delete( $activity, $user_ids, $activity_object = null, $context = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 46 | - // The shared inbox invokes this once per resolved recipient and once on the shared hook; | |
| 47 | - // handle that path only on the shared hook, so it runs once with the full recipient list. | |
| 48 | - if ( Inbox::CONTEXT_SHARED_INBOX === $context && 'activitypub_inbox_shared_delete' !== \current_filter() ) { | |
| 49 | - return; | |
| 50 | - } | |
| 51 | - | |
| 41 | + public static function handle_delete( $activity, $user_ids ) { | |
| 52 | 42 | $object_type = $activity['object']['type'] ?? ''; |
| 53 | 43 | |
| 54 | 44 | switch ( $object_type ) { |
| 55 | 45 | /* |