Output Atom self link in home timeline

This commit is contained in:
Zach Copley 2010-03-12 03:15:51 +00:00
parent 0444cc7bfb
commit 849d0b5dcd
1 changed files with 14 additions and 25 deletions

View File

@ -72,7 +72,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
common_debug("api home_timeline");
$this->user = $this->getTargetUser($this->arg('id')); $this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) { if (empty($this->user)) {
@ -121,8 +121,15 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->user->nickname, $sitename $this->user->nickname, $sitename
); );
$logo = (!empty($avatar)) $link = common_local_url(
? $avatar->displayUrl() 'all',
array('nickname' => $this->user->nickname)
);
$self = $this->getSelfUri();
$logo = (!empty($avatar))
? $avatar->displayUrl()
: Avatar::defaultImage(AVATAR_PROFILE_SIZE); : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
switch($this->format) { switch($this->format) {
@ -130,17 +137,14 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->showXmlTimeline($this->notices); $this->showXmlTimeline($this->notices);
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':
@ -155,23 +159,8 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$atom->setLogo($logo); $atom->setLogo($logo);
$atom->setUpdated('now'); $atom->setUpdated('now');
$atom->addLink( $atom->addLink($link);
common_local_url( $atom->setSelfLink($self);
'all',
array('nickname' => $this->user->nickname)
)
);
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
$atom->addLink(
$this->getSelfUri('ApiTimelineHome', $aargs),
array('rel' => 'self', 'type' => 'application/atom+xml')
);
$atom->addEntryFromNotices($this->notices); $atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString()); $this->raw($atom->getString());