From af3e61ca832a8d8c9b2d744747f1345576baad21 Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Wed, 1 Nov 2023 16:51:52 -0500 Subject: [PATCH] only try to merge mention inboxes when valid --- includes/class-activity-dispatcher.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/class-activity-dispatcher.php b/includes/class-activity-dispatcher.php index 2ba3e5d..fe31d37 100644 --- a/includes/class-activity-dispatcher.php +++ b/includes/class-activity-dispatcher.php @@ -140,11 +140,20 @@ class Activity_Dispatcher { */ private static function send_activity_to_inboxes( $activity, $user_id ) { $follower_inboxes = Followers::get_inboxes( $user_id ); - $mentioned_inboxes = Mention::get_inboxes( $activity->get_cc() ); + + $mentioned_inboxes = array(); + $cc = $activity->get_cc(); + if ( $cc ) { + $mentioned_inboxes = Mention::get_inboxes( $cc ); + } $inboxes = array_merge( $follower_inboxes, $mentioned_inboxes ); $inboxes = array_unique( $inboxes ); + if ( empty( $inboxes ) ) { + return; + } + $json = $activity->to_json(); foreach ( $inboxes as $inbox ) {