summaryrefslogtreecommitdiff
path: root/actions/apitimelineuser.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-03 12:51:23 -0800
committerBrion Vibber <brion@pobox.com>2010-03-03 16:33:20 -0800
commit9fadf8da1164d620284917b829329e195aa2a226 (patch)
treeff642f7abca80ee2e9b1d6ba1c97c20b250a88bd /actions/apitimelineuser.php
parent04e474c98c9b907fe2d0f263fad79018a15c0783 (diff)
Put all required field setup into AtomUserNoticeFeed and AtomGroupNoticeFeed, consolidating some code. (RSS feeds pulling title, logo etc from the Atom data structure so we don't dupe it.)
OStatus now calling the feed classes directly instead of faking a call into the API, should be less flakey.
Diffstat (limited to 'actions/apitimelineuser.php')
-rw-r--r--actions/apitimelineuser.php51
1 files changed, 10 insertions, 41 deletions
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 94491946c..2d0047c04 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -112,19 +112,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
function showTimeline()
{
$profile = $this->user->getProfile();
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
- $sitename = common_config('site', 'name');
- $title = sprintf(_("%s timeline"), $this->user->nickname);
+ // We'll use the shared params from the Atom stub
+ // for other feed types.
+ $atom = new AtomUserNoticeFeed($this->user);
+ $title = $atom->title;
$link = common_local_url(
'showstream',
array('nickname' => $this->user->nickname)
);
- $subtitle = sprintf(
- _('Updates from %1$s on %2$s!'),
- $this->user->nickname, $sitename
- );
- $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
+ $subtitle = $atom->subtitle;
+ $logo = $atom->logo;
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
@@ -146,47 +144,18 @@ class ApiTimelineUserAction extends ApiBareAuthAction
header('Content-Type: application/atom+xml; charset=utf-8');
- // @todo set all this Atom junk up inside the feed class
-
- $atom = new AtomUserNoticeFeed($this->user);
-
- $atom->setTitle($title);
- $atom->setSubtitle($subtitle);
- $atom->setLogo($logo);
- $atom->setUpdated('now');
-
- $atom->addLink(
- common_local_url(
- 'showstream',
- array('nickname' => $this->user->nickname)
- )
- );
-
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
-
- $atom->setId($this->getSelfUri('ApiTimelineUser', $aargs));
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineUser', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
-
- $atom->addLink(
- $suplink,
- array(
- 'rel' => 'http://api.friendfeed.com/2008/03#sup',
- 'type' => 'application/json'
- )
- );
+ $self = $this->getSelfUri('ApiTimelineUser', $aargs);
+ $atom->setId($self);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
- #$this->raw($atom->getString());
- print $atom->getString(); // temporary for output buffering
+ $this->raw($atom->getString());
break;
case 'json':