From 4b090c2c08db628e072460bfadab5ecba072d803 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 8 Nov 2020 14:21:08 -0500 Subject: [PATCH] Never mention yourself in AP messages --- src/Protocol/ActivityPub/Transmitter.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index f5ef35337..5a1458932 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1425,7 +1425,7 @@ class Transmitter } if (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) { - $body = self::prependMentions($body, $item['uri-id']); + $body = self::prependMentions($body, $item['uri-id'], $item['author-link']); } if ($type == 'Event') { @@ -1973,7 +1973,7 @@ class Transmitter return HTTPSignature::transmit($signed, $profile['inbox'], $uid); } - private static function prependMentions($body, int $uriid) + private static function prependMentions($body, int $uriid, string $authorLink) { $mentions = []; @@ -1983,6 +1983,7 @@ class Transmitter && $profile['contact-type'] != Contact::TYPE_COMMUNITY && !strstr($body, $profile['addr']) && !strstr($body, $tag['url']) + && $tag['url'] !== $authorLink ) { $mentions[] = '@[url=' . $tag['url'] . ']' . $profile['nick'] . '[/url]'; }