]> git.mxchange.org Git - friendica.git/commitdiff
[AP] Use contact.alias if it exists instead of contact.url for mention links
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 9 Nov 2020 04:32:02 +0000 (23:32 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 9 Nov 2020 04:32:02 +0000 (23:32 -0500)
- Make mentions links handled by Mastodon for logged in users

src/Protocol/ActivityPub/Transmitter.php

index bc4b31fb129b876013a26089e5a2170ed53b8d89..750c7f625ded1be969e3d15e335f319912912363 100644 (file)
@@ -1253,12 +1253,12 @@ class Transmitter
                        return '';
                }
 
-               $data = Contact::getByURL($match[1], false, ['url', 'nick']);
+               $data = Contact::getByURL($match[1], false, ['url', 'alias', 'nick']);
                if (empty($data['nick'])) {
                        return $match[0];
                }
 
-               return '[url=' . $data['url'] . ']@' . $data['nick'] . '[/url]';
+               return '[url=' . ($data['alias'] ?: $data['url']) . ']@' . $data['nick'] . '[/url]';
        }
 
        /**