]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better handling of tagged notice streams
authorEvan Prodromou <evan@status.net>
Sun, 18 Sep 2011 16:33:35 +0000 (12:33 -0400)
committerEvan Prodromou <evan@status.net>
Sun, 18 Sep 2011 16:33:35 +0000 (12:33 -0400)
actions/showstream.php
lib/taggedprofilenoticestream.php

index ee8bc18e72ffeb8cc97c6e52fc33b92bcf7991db..ccd976a0e30fe30a2151335451b554b60241c117 100644 (file)
@@ -55,6 +55,25 @@ require_once INSTALLDIR.'/lib/feedlist.php';
  */
 class ShowstreamAction extends ProfileAction
 {
+    var $notice;
+
+    function prepare($args)
+    {
+        parent::prepare($args);
+
+        $p = Profile::current();
+
+        if (empty($this->tag)) {
+            $stream = new ProfileNoticeStream($this->profile, $p);
+        } else {
+            $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p);
+        }
+
+        $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+
+        return true;
+    }
+
     function isReadOnly($args)
     {
         return true;
@@ -224,13 +243,9 @@ class ShowstreamAction extends ProfileAction
 
     function showNotices()
     {
-        $notice = empty($this->tag)
-          ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
-            : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
-
         $pnl = null;
-        if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) {
-            $pnl = new ProfileNoticeList($notice, $this);
+        if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
+            $pnl = new ProfileNoticeList($this->notice, $this);
         }
         $cnt = $pnl->show();
         if (0 == $cnt) {
index 9998b7d7699a8550c5c5adc959bacda28d5e19f7..eec20cd8c660153f209ba1c518adc05d7da0fe95 100644 (file)
@@ -47,7 +47,7 @@ if (!defined('STATUSNET')) {
 
 class TaggedProfileNoticeStream extends ScopingNoticeStream
 {
-    function __construct($profile, $tag, $userProfile)
+    function __construct($profile, $tag, $userProfile=-1)
     {
         if (is_int($userProfile) && $userProfile == -1) {
             $userProfile = Profile::current();