]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinepublic.php
Merge commit 'refs/merge-requests/29' of https://gitorious.org/social/mainline into...
[quix0rs-gnu-social.git] / actions / apitimelinepublic.php
index 47e253d5fd6124dbca30354fe747995b89a03ea2..300dd58b238f119367bcbe99020bf6f35f3689a7 100644 (file)
@@ -38,8 +38,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/apiprivateauth.php';
-
 /**
  * Returns the most recent notices (default 20) posted by everybody
  *
@@ -156,7 +154,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
      * @return boolean success flag
      *
      */
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -174,7 +172,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
      *
      * @return void
      */
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
         $this->showTimeline();
@@ -258,14 +256,18 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
     {
         $notices = array();
 
-        $notice = Notice::publicStream(
-            ($this->page - 1) * $this->count, $this->count, $this->since_id,
-            $this->max_id
-        );
+        $profile = ($this->auth_user) ? $this->auth_user->getProfile() : null;
 
-        while ($notice->fetch()) {
-            $notices[] = clone($notice);
-        }
+        $stream = new PublicNoticeStream($profile);
+
+        $notice = $stream->getNotices(($this->page - 1) * $this->count,
+                                      $this->count,
+                                      $this->since_id,
+                                      $this->max_id);
+
+        $notices = $notice->fetchAll();
+
+        NoticeList::prefill($notices);
 
         return $notices;
     }
@@ -277,7 +279,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
      *
      * @return boolean true
      */
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         return true;
     }