| @@ -3,8 +3,10 @@ | ||
| 3 | 3 | |
| 4 | 4 | use Activitypub\Collection\Users; |
| 5 | 5 | use Activitypub\Collection\Followers; |
| 6 | 6 | |
| 7 | +use function Activitypub\object_to_uri; | |
| 8 | + | |
| 7 | 9 | /** |
| 8 | 10 | * Handle Undo requests |
| 9 | 11 | */ |
| 10 | 12 | class Undo { |
| @@ -27,12 +29,12 @@ | ||
| 27 | 29 | public static function handle_undo( $activity ) { |
| 28 | 30 | if ( |
| 29 | 31 | isset( $activity['object']['type'] ) && |
| 30 | 32 | 'Follow' === $activity['object']['type'] && |
| 31 | - isset( $activity['object']['object'] ) && | |
| 32 | - filter_var( $activity['object']['object'], FILTER_VALIDATE_URL ) | |
| 33 | + isset( $activity['object']['object'] ) | |
| 33 | 34 | ) { |
| 34 | - $user = Users::get_by_resource( $activity['object']['object'] ); | |
| 35 | + $user_id = object_to_uri( $activity['object']['object'] ); | |
| 36 | + $user = Users::get_by_resource( $user_id ); | |
| 35 | 37 | |
| 36 | 38 | if ( ! $user || is_wp_error( $user ) ) { |
| 37 | 39 | // If we can not find a user, |
| 38 | 40 | // we can not initiate a follow process |
| @@ -39,9 +41,10 @@ | ||
| 39 | 41 | return; |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | $user_id = $user->get__id(); |
| 45 | + $actor = object_to_uri( $activity['actor'] ); | |
| 43 | 46 | |
| 44 | - Followers::remove_follower( $user_id, $activity['actor'] ); | |
| 47 | + Followers::remove_follower( $user_id, $actor ); | |
| 45 | 48 | } |
| 46 | 49 | } |
| 47 | 50 | } |