X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapitimelinepublic.php;h=338cd16fa093eff36a9a0c22081146ceed0cb56b;hb=d1b10ee92bec69e8401bca743b8145f98437074f;hp=353973b6533a9d76fe25008a773db90dbb716272;hpb=880b1b666eeaedee2c9570142b2d0cd56f1d96f1;p=quix0rs-gnu-social.git diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index 353973b653..338cd16fa0 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -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 * @@ -235,7 +233,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction $this->showJsonTimeline($this->notices); break; case 'as': - header('Content-Type: application/json; charset=utf-8'); + header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($title); $doc->addLink($link, 'alternate', 'text/html'); @@ -243,7 +241,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction $this->raw($doc->asString()); break; default: - // TRANS: Client error displayed when trying to handle an unknown API method. + // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } @@ -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; }