]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/replies.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / replies.php
index 49098d0950781f62942b29dc0fb131089e70e0fc..efe0d62beb9b59337b9f9df0f8978b24e9ce6434 100644 (file)
@@ -38,42 +38,11 @@ if (!defined('GNUSOCIAL')) { exit(1); }
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class RepliesAction extends ManagedAction
+class RepliesAction extends ShowstreamAction
 {
-    var $page = null;
-    var $notice;
-
-    protected function doPreparation()
+    public function getStream()
     {
-        $nickname = common_canonical_nickname($this->arg('nickname'));
-
-        $this->user = User::getKV('nickname', $nickname);
-
-        if (!$this->user instanceof User) {
-            // TRANS: Client error displayed when trying to reply to a non-exsting user.
-            $this->clientError(_('No such user.'));
-        }
-
-        $this->target = $this->user->getProfile();
-
-        if (!$this->target instanceof Profile) {
-            // TRANS: Error message displayed when referring to a user without a profile.
-            $this->serverError(_('User has no profile.'));
-        }
-
-        $this->page = $this->int('page') ?: 1;
-
-        common_set_returnto($this->selfUrl());
-
-        $stream = new ReplyNoticeStream($this->target->getID(), $this->scoped);
-
-        $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE,
-                                            NOTICES_PER_PAGE + 1);
-
-        if ($this->page > 1 && $this->notice->N == 0) {
-            // TRANS: Client error when page not found (404)
-            $this->clientError(_('No such page.'), 404);
-        }
+        return new ReplyNoticeStream($this->target->getID(), $this->scoped);
     }
 
     /**
@@ -113,7 +82,7 @@ class RepliesAction extends ManagedAction
                               // TRANS: Link for feed with replies for a user.
                               // TRANS: %s is a user nickname.
                               sprintf(_('Replies feed for %s (Activity Streams JSON)'),
-                                      $this->user->nickname)),
+                                      $this->target->getNickname())),
                      new Feed(Feed::RSS1,
                               common_local_url('repliesrss',
                                                array('nickname' => $this->target->getNickname())),
@@ -183,7 +152,7 @@ class RepliesAction extends ManagedAction
         $this->elementEnd('div');
     }
 
-    public function isReadOnly($args)
+    public function isReadOnly(array $args = array())
     {
         return true;
     }