| @@ -55,26 +55,16 @@ | ||
| 55 | 55 | * @param array $reject The activity-object. |
| 56 | 56 | * @param int|int[] $user_ids The user ID(s). |
| 57 | 57 | */ |
| 58 | 58 | private static function reject_follow( $reject, $user_ids ) { |
| 59 | - /* | |
| 60 | - * For a Follow Reject, the sender must be the actor that was followed. | |
| 61 | - * Without this, a signed Reject from one actor could cancel a Follow that | |
| 62 | - * targeted another actor by referencing that pending Follow's outbox GUID. | |
| 63 | - */ | |
| 64 | - $reject_actor = object_to_uri( $reject['actor'] ?? '' ); | |
| 65 | - $followed_actor = object_to_uri( $reject['object']['object'] ?? '' ); | |
| 66 | - if ( ! $reject_actor || ! $followed_actor || $reject_actor !== $followed_actor ) { | |
| 67 | - return; | |
| 68 | - } | |
| 59 | + $actor_uri = $reject['object']['actor'] ?? ''; | |
| 60 | + $actor_post = Remote_Actors::get_by_uri( object_to_uri( $actor_uri ) ); | |
| 69 | 61 | |
| 70 | - $actor_post = Remote_Actors::get_by_uri( $followed_actor ); | |
| 71 | - | |
| 72 | 62 | if ( \is_wp_error( $actor_post ) ) { |
| 73 | 63 | return; |
| 74 | 64 | } |
| 75 | 65 | |
| 76 | - $user_id = \is_array( $user_ids ) ? \reset( $user_ids ) : $user_ids; | |
| 66 | + $user_id = is_array( $user_ids ) ? reset( $user_ids ) : $user_ids; | |
| 77 | 67 | $result = Following::reject( $actor_post, $user_id ); |
| 78 | 68 | $success = ! \is_wp_error( $result ); |
| 79 | 69 | |
| 80 | 70 | /** |
| @@ -108,16 +98,8 @@ | ||
| 108 | 98 | return $valid; |
| 109 | 99 | } |
| 110 | 100 | |
| 111 | 101 | if ( ! isset( $activity['actor'], $activity['object'] ) ) { |
| 112 | - return false; | |
| 113 | - } | |
| 114 | - | |
| 115 | - if ( ! \is_array( $activity['object'] ) ) { | |
| 116 | - return false; | |
| 117 | - } | |
| 118 | - | |
| 119 | - if ( ! isset( $activity['object']['id'], $activity['object']['type'], $activity['object']['actor'], $activity['object']['object'] ) ) { | |
| 120 | 102 | return false; |
| 121 | 103 | } |
| 122 | 104 | |
| 123 | 105 | return $valid; |