]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #9507 from MrPetovan/bug/9480-never-mention-yourself
authorMichael Vogel <icarus@dabo.de>
Sun, 8 Nov 2020 21:37:07 +0000 (22:37 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Nov 2020 21:37:07 +0000 (22:37 +0100)
Never mention yourself

src/Protocol/ActivityPub/Transmitter.php

index f5ef35337af8a3964fe5b539a64c47e3480db266..bc4b31fb129b876013a26089e5a2170ed53b8d89 100644 (file)
@@ -1258,7 +1258,7 @@ class Transmitter
                        return $match[0];
                }
 
-               return '@[url=' . $data['url'] . ']' . $data['nick'] . '[/url]';
+               return '[url=' . $data['url'] . ']@' . $data['nick'] . '[/url]';
        }
 
        /**
@@ -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]';
                        }