Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Dec 19, 2024
1 parent af9e12f commit 5db6876
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions includes/class-mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,15 @@ public static function new_follower( $notification ) {
* @param int $user_id The id of the local blog-user.
*/
public static function direct_message( $activity, $user_id ) {
$recipients = extract_recipients_from_activity( $activity );

if (
is_activity_public( $activity ) ||
! in_array( \get_author_posts_url( $user_id ), $recipients, true )
// Only accept messages that have the user in the "to" field.
empty( $activity['to'] ) ||
! in_array( \get_author_posts_url( $user_id ), (array) $activity['to'], true )
) {
return;
}

// Only accept messages that have the user in the "to" field.
if ( ! in_array( \get_author_posts_url( $user_id ), $activity['to'], true ) ) {
return;
}

$actor = get_remote_metadata_by_actor( $activity['actor'] );

if ( ! $actor || \is_wp_error( $actor ) || empty( $activity['object']['content'] ) ) {
Expand Down

0 comments on commit 5db6876

Please sign in to comment.