]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Show <activity:subject> and no activity actors for user feed
authorEvan Prodromou <evan@status.net>
Tue, 2 Mar 2010 07:54:52 +0000 (02:54 -0500)
committerEvan Prodromou <evan@status.net>
Tue, 2 Mar 2010 07:54:52 +0000 (02:54 -0500)
We only need one author for user feeds: the user themselves. So, show
the user as the activity:subject, and don't repeat the same
activity:actor for every notice unnecessarily.

classes/Notice.php
lib/atomnoticefeed.php
lib/atomusernoticefeed.php

index 3702dbcfa8e59010b1ee07aba9983eb8b1f1e3a8..4b5dbb416f68e5691b9c6f7244ebc1fae8ac02a2 100644 (file)
@@ -1090,7 +1090,7 @@ class Notice extends Memcached_DataObject
         return $groups;
     }
 
-    function asAtomEntry($namespace=false, $source=false)
+    function asAtomEntry($namespace=false, $source=false, $author=true)
     {
         $profile = $this->getProfile();
 
@@ -1136,8 +1136,10 @@ class Notice extends Memcached_DataObject
         $xs->element('title', null, $this->content);
         $xs->element('summary', null, $this->content);
 
-        $xs->raw($profile->asAtomAuthor());
-        $xs->raw($profile->asActivityActor());
+        if ($author) {
+            $xs->raw($profile->asAtomAuthor());
+            $xs->raw($profile->asActivityActor());
+        }
 
         $xs->element('link', array('rel' => 'alternate',
                                    'type' => 'text/html',
index 3c3556cb95c789c59c951440cf73c6b12ad64801..e4df731fe02a5c3bdb7657f6d504177395345ae1 100644 (file)
@@ -107,9 +107,19 @@ class AtomNoticeFeed extends Atom10Feed
      */
     function addEntryFromNotice($notice)
     {
-        $this->addEntryRaw($notice->asAtomEntry());
-    }
+        $source = $this->showSource();
+        $author = $this->showAuthor();
 
-}
+        $this->addEntryRaw($notice->asAtomEntry(false, $source, $author));
+    }
 
+    function showSource()
+    {
+        return true;
+    }
 
+    function showAuthor()
+    {
+        return true;
+    }
+}
index 2ad8de4550d1a3c3aac8b694f974a4ebf9e19c2d..6485aaa43dc3bb94992f6c477660a63cb34c30dc 100644 (file)
@@ -61,6 +61,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
         if (!empty($user)) {
             $profile = $user->getProfile();
             $this->addAuthor($profile->nickname, $user->uri);
+            $this->setActivitySubject($profile->asActivityNoun('subject'));
         }
     }
 
@@ -68,4 +69,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
     {
         return $this->user;
     }
+
+    function showSource()
+    {
+        return false;
+    }
+
+    function showAuthor()
+    {
+        return false;
+    }
 }