]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Changed ShowfavoritesAction to use Action functions for profiles
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 7 Jul 2016 09:11:20 +0000 (11:11 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 7 Jul 2016 09:11:20 +0000 (11:11 +0200)
plugins/Favorite/actions/showfavorites.php

index ea1169957c0a761d2628a38598e7a2aaee18a052..08366e4c16e348df92ab967bb57c7dcd9dd87563 100644 (file)
@@ -65,53 +65,52 @@ class ShowfavoritesAction extends ShowstreamAction
         return array(new Feed(Feed::JSON,
                               common_local_url('ApiTimelineFavorites',
                                                array(
-                                                    'id' => $this->user->nickname,
+                                                    'id' => $this->getTarget()->getNickname(),
                                                     'format' => 'as')),
                               // TRANS: Feed link text. %s is a username.
                               sprintf(_('Feed for favorites of %s (Activity Streams JSON)'),
-                                      $this->user->nickname)),
+                                      $this->getTarget()->getNickname())),
                      new Feed(Feed::RSS1,
                               common_local_url('favoritesrss',
-                                               array('nickname' => $this->user->nickname)),
+                                               array('nickname' => $this->getTarget()->getNickname())),
                               // TRANS: Feed link text. %s is a username.
                               sprintf(_('Feed for favorites of %s (RSS 1.0)'),
-                                      $this->user->nickname)),
+                                      $this->getTarget()->getNickname())),
                      new Feed(Feed::RSS2,
                               common_local_url('ApiTimelineFavorites',
                                                array(
-                                                    'id' => $this->user->nickname,
+                                                    'id' => $this->getTarget()->getNickname(),
                                                     'format' => 'rss')),
                               // TRANS: Feed link text. %s is a username.
                               sprintf(_('Feed for favorites of %s (RSS 2.0)'),
-                                      $this->user->nickname)),
+                                      $this->getTarget()->getNickname())),
                      new Feed(Feed::ATOM,
                               common_local_url('ApiTimelineFavorites',
                                                array(
-                                                    'id' => $this->user->nickname,
+                                                    'id' => $this->getTarget()->getNickname(),
                                                     'format' => 'atom')),
                               // TRANS: Feed link text. %s is a username.
                               sprintf(_('Feed for favorites of %s (Atom)'),
-                                      $this->user->nickname)));
+                                      $this->getTarget()->getNickname())));
     }
 
     function showEmptyListMessage()
     {
         if (common_logged_in()) {
-            $current_user = common_current_user();
-            if ($this->user->id === $current_user->id) {
+            if ($this->getTarget()->sameAs($this->getScoped())) {
                 // TRANS: Text displayed instead of favourite notices for the current logged in user that has no favourites.
                 $message = _('You haven\'t chosen any favorite notices yet. Click the fave button on notices you like to bookmark them for later or shed a spotlight on them.');
             } else {
                 // TRANS: Text displayed instead of favourite notices for a user that has no favourites while logged in.
                 // TRANS: %s is a username.
-                $message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->user->nickname);
+                $message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->getTarget()->getNickname());
             }
         }
         else {
                 // TRANS: Text displayed instead of favourite notices for a user that has no favourites while not logged in.
                 // TRANS: %s is a username, %%%%action.register%%%% is a link to the user registration page.
                 // TRANS: (link text)[link] is a Mark Down link.
-            $message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->user->nickname);
+            $message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->getTarget()->getNickname());
         }
 
         $this->elementStart('div', 'guide');