only try to merge mention inboxes when valid

This commit is contained in:
Matt Wiebe 2023-11-01 16:51:52 -05:00
parent e3a78fbadc
commit af3e61ca83

View file

@ -140,11 +140,20 @@ class Activity_Dispatcher {
*/ */
private static function send_activity_to_inboxes( $activity, $user_id ) { private static function send_activity_to_inboxes( $activity, $user_id ) {
$follower_inboxes = Followers::get_inboxes( $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_merge( $follower_inboxes, $mentioned_inboxes );
$inboxes = array_unique( $inboxes ); $inboxes = array_unique( $inboxes );
if ( empty( $inboxes ) ) {
return;
}
$json = $activity->to_json(); $json = $activity->to_json();
foreach ( $inboxes as $inbox ) { foreach ( $inboxes as $inbox ) {