| @@ -40,9 +40,15 @@ | ||
| 40 | 40 | if ( empty( $url ) ) { |
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $exists = Comment::object_id_to_comment( esc_url_raw( $url ) ); | |
| 44 | + /* | |
| 45 | + * Dedupe on the Like activity ID (its source_id), not the liked object, so repeat | |
| 46 | + * deliveries stay idempotent even when a mangled author name defeats WordPress's own | |
| 47 | + * duplicate check. Match any status, so a like that was marked as spam or trashed | |
| 48 | + * still counts as seen. See https://github.com/Automattic/wordpress-activitypub/issues/3215. | |
| 49 | + */ | |
| 50 | + $exists = Comment::object_id_to_comment( \esc_url_raw( object_to_uri( $like ) ), array( 'status' => 'any' ) ); | |
| 45 | 51 | if ( $exists ) { |
| 46 | 52 | return; |
| 47 | 53 | } |
| 48 | 54 | |
| @@ -48,11 +54,11 @@ | ||
| 48 | 54 | |
| 49 | 55 | $success = false; |
| 50 | 56 | $result = Interactions::add_reaction( $like ); |
| 51 | 57 | |
| 52 | - if ( $result && ! is_wp_error( $result ) ) { | |
| 58 | + if ( $result && ! \is_wp_error( $result ) ) { | |
| 53 | 59 | $success = true; |
| 54 | - $result = get_comment( $result ); | |
| 60 | + $result = \get_comment( $result ); | |
| 55 | 61 | } |
| 56 | 62 | |
| 57 | 63 | /** |
| 58 | 64 | * Fires after an ActivityPub Like activity has been handled. |