X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fapitimelinegroup.php;h=3fc930fa08664630a01972676875ba7888d5a466;hb=e6fd3fa0383dfaa914d2e55965cd4676f56206c4;hp=a85da4b0f35c1dddd62ed132a7d4f0a5ae7e5619;hpb=e62254f8ccec8966ea197a35cba2fb7c18099303;p=quix0rs-gnu-social.git diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index a85da4b0f3..3fc930fa08 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -106,6 +106,11 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction $self = $this->getSelfUri(); + $link = common_local_url( + 'ApiTimelineGroup', + array('nickname' => $this->group->nickname) + ); + switch($this->format) { case 'xml': $this->showXmlTimeline($this->notices); @@ -123,28 +128,20 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); - - try { - $atom->addAuthorRaw($this->group->asAtomAuthor()); - $atom->setActivitySubject($this->group->asActivitySubject()); - $atom->setId($self); - $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); - } catch (Atom10FeedException $e) { - $this->serverError( - // TRANS: Server error displayed when generating an Atom feed fails. - // TRANS: %s is the error. - sprintf(_('Could not generate feed for group - %s'),$e->getMessage()), - 400, - $this->format - ); - return; - } break; case 'json': $this->showJsonTimeline($this->notices); break; + case 'as': + header('Content-Type: application/json; charset=utf-8'); + $doc = new ActivityStreamJSONDocument($this->auth_user); + $doc->setTitle($atom->title); + $doc->addLink($link, 'alternate', 'text/html'); + $doc->addItemsFromNotices($this->notices); + $this->raw($doc->asString()); + break; default: $this->clientError( // TRANS: Client error displayed when trying to handle an unknown API method.