]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelineuser.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / apitimelineuser.php
index cb82136195d008ca29b5ed6ed6ae52a52b27bc70..2d0047c0464f8723d75d418a7c318fa11c880331 100644 (file)
@@ -112,21 +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);
-        $taguribase = common_config('integration', 'taguri');
-        $id         = "tag:$taguribase:UserTimeline:" . $this->user->id;
+        // 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
@@ -148,44 +144,14 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
-
-            $atom->addLink(
-                common_local_url(
-                    'showstream',
-                    array('nickname' => $this->user->nickname)
-                )
-            );
-
-            $atom->setId($id);
-            $atom->setTitle($title);
-            $atom->setSubtitle($subtitle);
-            $atom->setLogo($logo);
-            $atom->setUpdated('now');
-
             $id = $this->arg('id');
-
-            if ($id) {
-                $selfuri = common_root_url() .
-                    'api/statuses/user_timeline/' .
-                    rawurlencode($id) . '.atom';
-            } else {
-                $selfuri = common_root_url() .
-                    'api/statuses/user_timeline.atom';
+            $aargs = array('format' => 'atom');
+            if (!empty($id)) {
+                $aargs['id'] = $id;
             }
-
-            $atom->addLink(
-                $selfuri,
-                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);
 
@@ -214,7 +180,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
         $notice = $this->user->getNotices(
             ($this->page-1) * $this->count, $this->count,
-            $this->since_id, $this->max_id, $this->since
+            $this->since_id, $this->max_id
         );
 
         while ($notice->fetch()) {