Use the profile URI when linking instead of URL

since we'll then get to /user/$id instead of /$nickname which is
good for future archives if someone changes their nickname...
This commit is contained in:
Mikael Nordfeldth 2016-01-29 15:21:01 +01:00
parent 5b11238010
commit cb40f72c7e
1 changed files with 4 additions and 1 deletions

View File

@ -771,7 +771,10 @@ function common_find_mentions($text, Profile $sender, Notice $parent=null)
if ($mentioned instanceof Profile) {
try {
$url = $mentioned->getUrl();
$url = $mentioned->getUri(); // prefer the URI as URL, if it is one.
if (!common_valid_http_url($url)) {
$url = $mentioned->getUrl();
}
} catch (InvalidUrlException $e) {
$url = common_local_url('userbyid', array('id' => $mentioned->getID()));
}