]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use the profile URI when linking instead of URL
authorMikael Nordfeldth <mmn@hethane.se>
Fri, 29 Jan 2016 14:21:01 +0000 (15:21 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Fri, 29 Jan 2016 14:21:01 +0000 (15:21 +0100)
since we'll then get to /user/$id instead of /$nickname which is
good for future archives if someone changes their nickname...

lib/util.php

index 4dd86fa3705d4ac64ddd89b9eefbec44833f03fc..b7eac68619c16ade5cb2d9ba80130d0f1b0a3c12 100644 (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()));
                 }