]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Take remote profiles into account when looking up canonical profile URIs
authorZach Copley <zach@status.net>
Wed, 17 Feb 2010 00:22:58 +0000 (16:22 -0800)
committerZach Copley <zach@status.net>
Wed, 17 Feb 2010 00:22:58 +0000 (16:22 -0800)
EVENTS.txt
classes/Notice.php
classes/Profile.php

index 69fe2ddccb37f24de7cd429b2151abdabe4e3f6c..f333c5442f3c2475dc8b691875d298930f0693b1 100644 (file)
@@ -1,4 +1,4 @@
-\InitializePlugin: a chance to initialize a plugin in a complete environment
+InitializePlugin: a chance to initialize a plugin in a complete environment
 
 CleanupPlugin: a chance to cleanup a plugin at the end of a program
 
@@ -722,3 +722,6 @@ StartRobotsTxt: Before outputting the robots.txt page
 EndRobotsTxt: After the default robots.txt page (good place for customization)
 - &$action: RobotstxtAction being shown
 
+GetProfileUri: When determining the canonical URI for a given profile
+- &$profile: the current profile
+
index 73b22d58a030cea41a8afbd67121e755f26954ad..f184b9c52c24962323bca5088131a20c89fede04 100644 (file)
@@ -1036,7 +1036,7 @@ class Notice extends Memcached_DataObject
                 $xs->element(
                     'link', array(
                         'rel' => 'ostatus:attention',
-                        'href' => $profile->getAcctUri()
+                        'href' => $profile->getUri()
                     )
                 );
             }
index 8f578c95a3eb8b897bff9309989679af726174fb..5a86619fd24ac7a6f92add9e9bcc52e7a8ce4f00 100644 (file)
@@ -810,10 +810,7 @@ class Profile extends Memcached_DataObject
         $xs->element(
             'id',
             null,
-            common_local_url(
-                'userbyid',
-                array('id' => $this->id)
-                )
+            $this->getUri()
             );
         $xs->element('title', null, $this->getBestName());
 
@@ -835,9 +832,21 @@ class Profile extends Memcached_DataObject
         return $xs->getString();
     }
 
-    function getAcctUri()
+    function getUri()
     {
-        return $this->nickname . '@' . common_config('site', 'server');
+        if (Event::handle('GetProfileUri', array($this))) {
+
+            $remote = Remote_profile::staticGet('id', $this->id);
+
+            if (!empty($remote)) {
+                return $remote->uri;
+            } else {
+                return common_local_url(
+                    'userbyid',
+                    array('id' => $this->id)
+                );
+            }
+        }
     }
 
 }