]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/filteringnoticestream.php
Merge commit 'refs/merge-requests/159' of git://gitorious.org/statusnet/mainline...
[quix0rs-gnu-social.git] / lib / filteringnoticestream.php
index a3bdc08af697746be4c663a78b99d89896a6252a..0b0fab481eb37393a1e336bab9ada36d7e65b63a 100644 (file)
@@ -56,7 +56,7 @@ abstract class FilteringNoticeStream extends NoticeStream
 
     abstract function filter($notice);
 
-    function getNotices($offset, $limit, $sinceId, $maxId)
+    function getNotices($offset, $limit, $sinceId=null, $maxId=null)
     {
         // "offset" is virtual; we have to get a lot
         $total = $offset + $limit;
@@ -81,10 +81,17 @@ abstract class FilteringNoticeStream extends NoticeStream
                 break;
             }
 
-            while ($raw->fetch()) {
-                if ($this->filter($raw)) {
-                    $filtered[] = clone($raw);
-                    if (count($filtered >= $total)) {
+                       $notices = $raw->fetchAll();
+                       
+                       // XXX: this should probably only be in the scoping one.
+                       
+                       Notice::fillGroups($notices);
+                       Notice::fillReplies($notices);
+                       
+                       foreach ($notices as $notice) {
+                if ($this->filter($notice)) {
+                    $filtered[] = $notice;
+                    if (count($filtered) >= $total) {
                         break;
                     }
                 }
@@ -107,7 +114,7 @@ abstract class FilteringNoticeStream extends NoticeStream
         $ids = array();
 
         while ($notices->fetch()) {
-            $ids[] = $notice->id;
+            $ids[] = $notices->id;
         }
 
         return $ids;