]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinepublic.php
Make Atom timelines in the API use Atom10feed
[quix0rs-gnu-social.git] / actions / apitimelinepublic.php
index 0fb0788e98795b286daf9b7f37f7d9cf0d92804c..c1fa72a3ee372f72e944931f86c6480bff17aabc 100644 (file)
@@ -74,7 +74,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
         parent::prepare($args);
 
         $this->notices = $this->getNotices();
-        
+
         if ($this->since) {
             throw new ServerException("since parameter is disabled for performance; use since_id", 403);
         }
@@ -122,11 +122,28 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo);
             break;
         case 'atom':
-            $selfuri = common_root_url() . 'api/statuses/public_timeline.atom';
-            $this->showAtomTimeline(
-                $this->notices, $title, $id, $link,
-                $subtitle, null, $selfuri, $sitelogo
+
+            $atom = new AtomNoticeFeed();
+
+            $atom->setId($id);
+            $atom->setTitle($title);
+            $atom->setSubtitle($subtitle);
+            $atom->setLogo($sitelogo);
+            $atom->setUpdated('now');
+
+            $atom->addLink(common_local_url('public'));
+
+            $atom->addLink(
+                $this->getSelfUri(
+                    'ApiTimelinePublic', array('format' => 'atom')
+                ),
+                array('rel' => 'self', 'type' => 'application/atom+xml')
             );
+
+            $atom->addEntryFromNotices($this->notices);
+
+            $this->raw($atom->getString());
+
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);