[AP] Use contact.alias if it exists instead of contact.url for mention links

- Make mentions links handled by Mastodon for logged in users
This commit is contained in:
Hypolite Petovan 2020-11-08 23:32:02 -05:00
parent edd439cfab
commit 7debe1e999

View 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]';
}
/**