]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showstream.php
some more extensions of ShowstreamAction broke in last commit
[quix0rs-gnu-social.git] / actions / showstream.php
index ee9891092c15223427c6fc5599c3306285984834..8e8b055b4b4749b3a51ad7248963386bb4aecccc 100644 (file)
@@ -79,6 +79,17 @@ class ShowstreamAction extends ProfileAction
     }
 
     protected function profileActionPreparation()
+    {
+        $stream = $this->getStream();
+        $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);
+        }
+    }
+
+    protected function getStream()
     {
         if (empty($this->tag)) {
             $stream = new ProfileNoticeStream($this->target, $this->scoped);
@@ -86,7 +97,7 @@ class ShowstreamAction extends ProfileAction
             $stream = new TaggedProfileNoticeStream($this->target, $this->tag, $this->scoped);
         }
 
-        $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+        return $stream;
     }