]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showprofiletag.php
Merge branch 'master' of https://git.gnu.io/gnu/gnu-social into social-master
[quix0rs-gnu-social.git] / actions / showprofiletag.php
index d1b0768d232aebf95dbf9a06896cf5b41a3dc6d7..1bb126bfbed879e31a248939f0cd7e015b212d1e 100644 (file)
@@ -35,16 +35,20 @@ class ShowprofiletagAction extends Action
 {
     var $notice, $tagger, $peopletag, $userProfile;
 
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         return true;
     }
 
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
-        $tagger_arg = $this->arg('tagger');
+        if (common_config('singleuser', 'enabled')) {
+            $tagger_arg = User::singleUserNickname();
+        } else {
+            $tagger_arg = $this->arg('tagger');
+        }
         $tag_arg = $this->arg('tag');
         $tagger = common_canonical_nickname($tagger_arg);
         $tag = common_canonical_tag($tag_arg);
@@ -57,21 +61,18 @@ class ShowprofiletagAction extends Action
                 $args['page'] = $this->page;
             }
             common_redirect(common_local_url('showprofiletag', $args), 301);
-            return false;
         }
 
         if (!$tagger) {
             // TRANS: Client error displayed when a tagger is expected but not provided.
             $this->clientError(_('No tagger.'), 404);
-            return false;
         }
 
-        $user = User::staticGet('nickname', $tagger);
+        $user = User::getKV('nickname', $tagger);
 
         if (!$user) {
             // TRANS: Client error displayed trying to perform an action related to a non-existing user.
             $this->clientError(_('No such user.'), 404);
-            return false;
         }
 
         $this->tagger = $user->getProfile();
@@ -84,7 +85,6 @@ class ShowprofiletagAction extends Action
         if (!$can_see) {
             // TRANS: Client error displayed trying to reference a non-existing list.
             $this->clientError(_('No such list.'), 404);
-            return false;
         }
 
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -96,21 +96,20 @@ class ShowprofiletagAction extends Action
                                             NOTICES_PER_PAGE + 1);
 
         if ($this->page > 1 && $this->notice->N == 0) {
-            // TRANS: Server error when page not found (404).
-            $this->serverError(_('No such page.'), $code = 404);
+            // TRANS: Client error when page not found (404).
+            $this->clientError(_('No such page.'), 404);
         }
 
         return true;
     }
 
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
 
         if (!$this->peopletag) {
             // TRANS: Client error displayed trying to perform an action related to a non-existing user.
             $this->clientError(_('No such user.'));
-            return;
         }
 
         $this->showPage();
@@ -169,7 +168,18 @@ class ShowprofiletagAction extends Action
     function getFeeds()
     {
         #XXX: make these actually work
-        return array(new Feed(Feed::RSS2,
+        return array(new Feed(Feed::JSON,
+                common_local_url(
+                    'ApiTimelineList', array(
+                        'user' => $this->tagger->id,
+                        'id' => $this->peopletag->id,
+                        'format' => 'as'
+                    )
+                ),
+                // TRANS: Feed title.
+                // TRANS: %s is tagger's nickname.
+                sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->tagger->nickname)),
+                new Feed(Feed::RSS2,
                 common_local_url(
                     'ApiTimelineList', array(
                         'user' => $this->tagger->id,
@@ -244,7 +254,7 @@ class ShowprofiletagAction extends Action
     function showNotices()
     {
         if (Event::handle('StartShowProfileTagContent', array($this))) {
-            $nl = new NoticeList($this->notice, $this);
+            $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
 
             $cnt = $nl->show();
 
@@ -339,17 +349,7 @@ class ShowprofiletagAction extends Action
                 }
             }
 
-            if ($cnt > PROFILES_PER_MINILIST) {
-                $this->elementStart('p');
-                $this->element('a', array('href' => common_local_url('profiletagsubscribers',
-                                                                     array('nickname' => $this->tagger->nickname,
-                                                                           'profiletag' => $this->peopletag->tag)),
-                                          'class' => 'more'),
-                               // TRANS: Link for more "People following tag x"
-                               // TRANS: if there are more than the mini list's maximum.
-                               _('All subscribers'));
-                $this->elementEnd('p');
-            }
+            // FIXME: link to full list
 
             Event::handle('EndShowProfileTagSubscribersMiniList', array($this));
         }
@@ -359,10 +359,12 @@ class ShowprofiletagAction extends Action
 
 class Peopletag extends PeopletagListItem
 {
+    protected $avatarSize = AVATAR_PROFILE_SIZE;
+
     function showStart()
     {
         $mode = $this->peopletag->private ? 'private' : 'public';
-        $this->out->elementStart('div', array('class' => 'hentry peopletag peopletag-profile mode-'.$mode,
+        $this->out->elementStart('div', array('class' => 'h-entry peopletag peopletag-profile mode-'.$mode,
                                              'id' => 'peopletag-' . $this->peopletag->id));
     }
 
@@ -370,9 +372,4 @@ class Peopletag extends PeopletagListItem
     {
         $this->out->elementEnd('div');
     }
-
-    function showAvatar()
-    {
-        parent::showAvatar(AVATAR_PROFILE_SIZE);
-    }
 }