]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showprofiletag.php
Make lists work in single-user mode
[quix0rs-gnu-social.git] / actions / showprofiletag.php
index 244e0e75d14939368466f20af95b883adcd35710..ec1837f835866a8a78d89545c4306caaf91cd9bf 100644 (file)
@@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action
     {
         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);
@@ -82,8 +86,8 @@ class ShowprofiletagAction extends Action
                    ($this->peopletag->private && $this->peopletag->tagger === $current->id));
 
         if (!$can_see) {
-            // TRANS: Client error displayed trying to reference a non-existing people tag.
-            $this->clientError(_('No such people tag.'), 404);
+            // TRANS: Client error displayed trying to reference a non-existing list.
+            $this->clientError(_('No such list.'), 404);
             return false;
         }
 
@@ -121,7 +125,7 @@ class ShowprofiletagAction extends Action
         if ($this->page > 1) {
             if($this->peopletag->private) {
                 // TRANS: Title for private list timeline.
-                // TRANS: %1$s is a people tag, %2$s is a page number.
+                // TRANS: %1$s is a list, %2$s is a page number.
                 return sprintf(_('Private timeline for %1$s list by you, page %2$d'),
                                 $this->peopletag->tag, $this->page);
             }
@@ -129,13 +133,13 @@ class ShowprofiletagAction extends Action
             $current = common_current_user();
             if (!empty($current) && $current->id == $this->peopletag->tagger) {
                 // TRANS: Title for public list timeline where the viewer is the tagger.
-                // TRANS: %1$s is a people tag, %2$s is a page number.
+                // TRANS: %1$s is a list, %2$s is a page number.
                 return sprintf(_('Timeline for %1$s list by you, page %2$d'),
                                 $this->peopletag->tag, $this->page);
             }
 
             // TRANS: Title for private list timeline.
-            // TRANS: %1$s is a people tag, %2$s is the tagger's nickname, %3$d is a page number.
+            // TRANS: %1$s is a list, %2$s is the tagger's nickname, %3$d is a page number.
             return sprintf(_('Timeline for %1$s list by %2$s, page %3$d'),
                                 $this->peopletag->tag,
                                 $this->tagger->nickname,
@@ -169,7 +173,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,
@@ -214,11 +229,11 @@ class ShowprofiletagAction extends Action
         if (common_logged_in()) {
             $current_user = common_current_user();
             if ($this->tagger->id == $current_user->id) {
-                // TRANS: Additional empty list message for people tag timeline for currently logged in user tagged tags.
+                // TRANS: Additional empty list message for list timeline for currently logged in user tagged tags.
                 $message .= _('Try tagging more people.');
             }
         } else {
-            // TRANS: Additional empty list message for people tag timeline.
+            // TRANS: Additional empty list message for list timeline.
             // TRANS: This message contains Markdown links in the form [description](link).
             $message .= _('Why not [register an account](%%%%action.register%%%%) and start following this timeline!');
         }
@@ -307,7 +322,7 @@ class ShowprofiletagAction extends Action
                                                                      array('nickname' => $this->tagger->nickname,
                                                                            'profiletag' => $this->peopletag->tag)),
                                           'class' => 'more'),
-                               // TRANS: Link for more "People tagged x by a user"
+                               // TRANS: Link for more "People in list x by a user"
                                // TRANS: if there are more than the mini list's maximum.
                                _('Show all'));
                 $this->elementEnd('p');
@@ -339,17 +354,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));
         }