]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinefriends.php
Missed change when refactoring groups. Thanks macno
[quix0rs-gnu-social.git] / actions / apitimelinefriends.php
index e84f7737235cce4958962bf2fca026e28674d359..4e3827baea61a5bf9f1c947e8f2cad55b86d7f08 100644 (file)
@@ -72,7 +72,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
     function prepare($args)
     {
         parent::prepare($args);
-        common_debug("api friends_timeline");
         $this->user = $this->getTargetUser($this->arg('id'));
 
         if (empty($this->user)) {
@@ -110,24 +109,26 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
     function showTimeline()
     {
         $profile    = $this->user->getProfile();
+        $avatar     = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         $sitename   = common_config('site', 'name');
         $title      = sprintf(_("%s and friends"), $this->user->nickname);
         $taguribase = common_config('integration', 'taguri');
         $id         = "tag:$taguribase:FriendsTimeline:" . $this->user->id;
         $link       = common_local_url(
-            'all', array('nickname' => $this->user->nickname)
-        );
+                                       'all', array('nickname' => $this->user->nickname)
+                                       );
         $subtitle   = sprintf(
-            _('Updates from %1$s and friends on %2$s!'),
-            $this->user->nickname, $sitename
-        );
+                              _('Updates from %1$s and friends on %2$s!'),
+                              $this->user->nickname, $sitename
+                              );
+        $logo       = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
 
         switch($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
-            $this->showRssTimeline($this->notices, $title, $link, $subtitle);
+            $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo);
             break;
         case 'atom':
 
@@ -135,23 +136,23 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
 
             if (isset($target_id)) {
                 $selfuri = common_root_url() .
-                    'api/statuses/friends_timeline/' .
-                    $target_id . '.atom';
+                  'api/statuses/friends_timeline/' .
+                  $target_id . '.atom';
             } else {
                 $selfuri = common_root_url() .
-                    'api/statuses/friends_timeline.atom';
+                  'api/statuses/friends_timeline.atom';
             }
 
             $this->showAtomTimeline(
-                $this->notices, $title, $id, $link,
-                $subtitle, null, $selfuri
-            );
+                                    $this->notices, $title, $id, $link,
+                                    $subtitle, null, $selfuri, $logo
+                                    );
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
-            $this->clientError(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found.'), $code = 404);
             break;
         }
     }
@@ -167,17 +168,13 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
         $notices = array();
 
         if (!empty($this->auth_user) && $this->auth_user->id == $this->user->id) {
-            $notice = $this->user->noticeInbox(
-                ($this->page-1) * $this->count,
-                $this->count, $this->since_id,
-                $this->max_id, $this->since
-            );
+            $notice = $this->user->ownFriendsTimeline(($this->page-1) * $this->count,
+                                                      $this->count, $this->since_id,
+                                                      $this->max_id, $this->since);
         } else {
-            $notice = $this->user->noticesWithFriends(
-                ($this->page-1) * $this->count,
-                $this->count, $this->since_id,
-                $this->max_id, $this->since
-            );
+            $notice = $this->user->friendsTimeline(($this->page-1) * $this->count,
+                                                   $this->count, $this->since_id,
+                                                   $this->max_id, $this->since);
         }
 
         while ($notice->fetch()) {
@@ -231,14 +228,14 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
             $last = count($this->notices) - 1;
 
             return '"' . implode(
-                ':',
-                array($this->arg('action'),
-                      common_language(),
-                      $this->user->id,
-                      strtotime($this->notices[0]->created),
-                      strtotime($this->notices[$last]->created))
-            )
-            . '"';
+                                 ':',
+                                 array($this->arg('action'),
+                                       common_language(),
+                                       $this->user->id,
+                                       strtotime($this->notices[0]->created),
+                                       strtotime($this->notices[$last]->created))
+                                 )
+              . '"';
         }
 
         return null;