Commit c892726c authored by Zach Copley's avatar Zach Copley

Take remote profiles into account when looking up canonical profile URIs

parent 014a32e6
\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 CleanupPlugin: a chance to cleanup a plugin at the end of a program
...@@ -722,3 +722,6 @@ StartRobotsTxt: Before outputting the robots.txt page ...@@ -722,3 +722,6 @@ StartRobotsTxt: Before outputting the robots.txt page
EndRobotsTxt: After the default robots.txt page (good place for customization) EndRobotsTxt: After the default robots.txt page (good place for customization)
- &$action: RobotstxtAction being shown - &$action: RobotstxtAction being shown
GetProfileUri: When determining the canonical URI for a given profile
- &$profile: the current profile
...@@ -1036,7 +1036,7 @@ class Notice extends Memcached_DataObject ...@@ -1036,7 +1036,7 @@ class Notice extends Memcached_DataObject
$xs->element( $xs->element(
'link', array( 'link', array(
'rel' => 'ostatus:attention', 'rel' => 'ostatus:attention',
'href' => $profile->getAcctUri() 'href' => $profile->getUri()
) )
); );
} }
......
...@@ -810,10 +810,7 @@ class Profile extends Memcached_DataObject ...@@ -810,10 +810,7 @@ class Profile extends Memcached_DataObject
$xs->element( $xs->element(
'id', 'id',
null, null,
common_local_url( $this->getUri()
'userbyid',
array('id' => $this->id)
)
); );
$xs->element('title', null, $this->getBestName()); $xs->element('title', null, $this->getBestName());
...@@ -835,9 +832,21 @@ class Profile extends Memcached_DataObject ...@@ -835,9 +832,21 @@ class Profile extends Memcached_DataObject
return $xs->getString(); 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)
);
}
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment