]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add self link to user and group rss2 feeds
authorZach Copley <zach@status.net>
Thu, 11 Mar 2010 23:43:03 +0000 (23:43 +0000)
committerZach Copley <zach@status.net>
Thu, 11 Mar 2010 23:43:03 +0000 (23:43 +0000)
actions/apitimelinegroup.php
actions/apitimelineuser.php

index 8f971392bf7650adbb9e1e2dec5eb331b21d0fe4..c4f8cbc653b4556b27b543bb78a53d293b74295d 100644 (file)
@@ -107,6 +107,14 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
         // We'll pull common formatting out of this for other formats
         $atom = new AtomGroupNoticeFeed($this->group);
 
+        // Calculate self link
+        $id = $this->arg('id');
+        $aargs = array('format' => $this->format);
+        if (!empty($id)) {
+            $aargs['id'] = $id;
+        }
+        $self = $this->getSelfUri('ApiTimelineGroup', $aargs);
+
         switch($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
@@ -118,7 +126,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
                 $this->group->homeUrl(),
                 $atom->subtitle,
                 null,
-                $atom->logo
+                $atom->logo,
+                $self
             );
             break;
         case 'atom':
@@ -126,24 +135,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
             header('Content-Type: application/atom+xml; charset=utf-8');
 
             try {
-
                 $atom->addAuthorRaw($this->group->asAtomAuthor());
                 $atom->setActivitySubject($this->group->asActivitySubject());
-
-                $id = $this->arg('id');
-                $aargs = array('format' => 'atom');
-                if (!empty($id)) {
-                    $aargs['id'] = $id;
-                }
-                $self = $this->getSelfUri('ApiTimelineGroup', $aargs);
-
                 $atom->setId($self);
                 $atom->setSelfLink($self);
-
                 $atom->addEntryFromNotices($this->notices);
-
                 $this->raw($atom->getString());
-
             } catch (Atom10FeedException $e) {
                 $this->serverError(
                     'Could not generate feed for group - ' . $e->getMessage()
index 2d0047c0464f8723d75d418a7c318fa11c880331..5c4bcace47862d1c780ca2d5af1a88098f72526c 100644 (file)
@@ -116,13 +116,19 @@ class ApiTimelineUserAction extends ApiBareAuthAction
         // We'll use the shared params from the Atom stub
         // for other feed types.
         $atom = new AtomUserNoticeFeed($this->user);
-        $title      = $atom->title;
-        $link       = common_local_url(
+
+        $link = common_local_url(
             'showstream',
             array('nickname' => $this->user->nickname)
         );
-        $subtitle = $atom->subtitle;
-        $logo = $atom->logo;
+
+        // Calculate self link
+        $id = $this->arg('id');
+        $aargs = array('format' => $this->format);
+        if (!empty($id)) {
+            $aargs['id'] = $id;
+        }
+        $self = $this->getSelfUri('ApiTimelineUser', $aargs);
 
         // FriendFeed's SUP protocol
         // Also added RSS and Atom feeds
@@ -136,25 +142,22 @@ class ApiTimelineUserAction extends ApiBareAuthAction
             break;
         case 'rss':
             $this->showRssTimeline(
-                $this->notices, $title, $link,
-                $subtitle, $suplink, $logo
+                $this->notices,
+                $atom->title,
+                $link,
+                $atom->subtitle,
+                $suplink,
+                $atom->logo,
+                $self
             );
             break;
         case 'atom':
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $id = $this->arg('id');
-            $aargs = array('format' => 'atom');
-            if (!empty($id)) {
-                $aargs['id'] = $id;
-            }
-            $self = $this->getSelfUri('ApiTimelineUser', $aargs);
             $atom->setId($self);
             $atom->setSelfLink($self);
-
             $atom->addEntryFromNotices($this->notices);
-
             $this->raw($atom->getString());
 
             break;