@@ -287,8 +287,15 @@ public static function handle_unfollow( $object, $user_id ) {
287287 public static function handle_reaction ( $ object , $ user_id ) {
288288 $ meta = \Activitypub \get_remote_metadata_by_actor ( $ object ['actor ' ] );
289289
290+ $ comment_post_id = \url_to_postid ( $ object ['object ' ] );
291+
292+ // save only replys and reactions
293+ if ( ! $ comment_post_id ) {
294+ return false ;
295+ }
296+
290297 $ commentdata = array (
291- 'comment_post_ID ' => \url_to_postid ( $ object [ ' object ' ] ) ,
298+ 'comment_post_ID ' => $ comment_post_id ,
292299 'comment_author ' => \esc_attr ( $ meta ['name ' ] ),
293300 'comment_author_email ' => '' ,
294301 'comment_author_url ' => \esc_url_raw ( $ object ['actor ' ] ),
@@ -319,8 +326,15 @@ public static function handle_reaction( $object, $user_id ) {
319326 public static function handle_create ( $ object , $ user_id ) {
320327 $ meta = \Activitypub \get_remote_metadata_by_actor ( $ object ['actor ' ] );
321328
329+ $ comment_post_id = \url_to_postid ( $ object ['object ' ]['inReplyTo ' ] );
330+
331+ // save only replys and reactions
332+ if ( ! $ comment_post_id ) {
333+ return false ;
334+ }
335+
322336 $ commentdata = array (
323- 'comment_post_ID ' => \url_to_postid ( $ object [ ' object ' ][ ' inReplyTo ' ] ) ,
337+ 'comment_post_ID ' => $ comment_post_id ,
324338 'comment_author ' => \esc_attr ( $ meta ['name ' ] ),
325339 'comment_author_url ' => \esc_url_raw ( $ object ['actor ' ] ),
326340 'comment_content ' => \wp_filter_kses ( $ object ['object ' ]['content ' ] ),
0 commit comments