From 7b9f99112bd07110c4e97956aeac20454ec405d0 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 26 Oct 2018 21:31:15 -0400 Subject: [PATCH] Don't create an AP object if the comment object already exists --- includes/client/comments.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/client/comments.php b/includes/client/comments.php index 82739cc..7c751ce 100644 --- a/includes/client/comments.php +++ b/includes/client/comments.php @@ -21,6 +21,13 @@ function handle_edit_comment( $comment_id ) { } function handle_transition_comment_status( $new_status, $old_status, $comment ) { + global $wpdb; + $existing = $wpdb->get_row( $wpdb->prepare( + "SELECT * FROM {$wpdb->prefix}pterotype_comments WHERE comment_id = %d", $comment->comment_ID + ) ); + if ( $existing ) { + return; + } // This creates a new commenter actor if necessary $actor_slug = get_comment_actor_slug( $comment ); $actor_outbox = get_rest_url(