Calculate Atom self link for friends timeline

This commit is contained in:
Zach Copley 2010-03-12 02:18:53 +00:00
parent d10cb89f6a
commit 0444cc7bfb

View File

@ -117,9 +117,17 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$subtitle = sprintf( $subtitle = sprintf(
_('Updates from %1$s and friends on %2$s!'), _('Updates from %1$s and friends on %2$s!'),
$this->user->nickname, $sitename $this->user->nickname,
$sitename
); );
$link = common_local_url(
'all',
array('nickname' => $this->user->nickname)
);
$self = $this->getSelfUri();
$logo = (!empty($avatar)) $logo = (!empty($avatar))
? $avatar->displayUrl() ? $avatar->displayUrl()
: Avatar::defaultImage(AVATAR_PROFILE_SIZE); : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
@ -130,19 +138,14 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
break; break;
case 'rss': case 'rss':
$link = common_local_url(
'all', array(
'nickname' => $this->user->nickname
)
);
$this->showRssTimeline( $this->showRssTimeline(
$this->notices, $this->notices,
$title, $title,
$link, $link,
$subtitle, $subtitle,
null, null,
$logo $logo,
$self
); );
break; break;
case 'atom': case 'atom':
@ -156,24 +159,8 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$atom->setSubtitle($subtitle); $atom->setSubtitle($subtitle);
$atom->setLogo($logo); $atom->setLogo($logo);
$atom->setUpdated('now'); $atom->setUpdated('now');
$atom->addLink($link);
$atom->addLink( $atom->setSelfLink($self);
common_local_url(
'all',
array('nickname' => $this->user->nickname)
)
);
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
$atom->addLink(
$this->getSelfUri('ApiTimelineFriends', $aargs),
array('rel' => 'self', 'type' => 'application/atom+xml')
);
$atom->addEntryFromNotices($this->notices); $atom->addEntryFromNotices($this->notices);