]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/atomusernoticefeed.php
Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / lib / atomusernoticefeed.php
index acfcbd75fb9fc25ad8ab5b4a0e23ea732167680b..fb0ac5f8313c88cd80504cfca650fb393d4a8d8d 100644 (file)
@@ -44,24 +44,44 @@ if (!defined('STATUSNET'))
  */
 class AtomUserNoticeFeed extends AtomNoticeFeed
 {
-    private $user;
+    protected $user;
 
     /**
      * Constructor
      *
      * @param User    $user    the user for the feed
+     * @param User    $cur     the current authenticated user, if any
      * @param boolean $indent  flag to turn indenting on or off
      *
      * @return void
      */
-
-    function __construct($user, $indent = true) {
-        parent::__construct($indent);
+    function __construct($user, $cur = null, $indent = true) {
+        parent::__construct($cur, $indent);
         $this->user = $user;
         if (!empty($user)) {
+
             $profile = $user->getProfile();
-            $this->addAuthor($profile->nickname, $user->uri);
-            $this->setActivitySubject($profile->asActivityNoun('subject'));
+
+            $ao = ActivityObject::fromProfile($profile);
+
+            array_push($ao->extra, $profile->profileInfo($cur));
+
+            // XXX: For users, we generate an author _AND_ an <activity:subject>
+            // This is for backward compatibility with clients (especially
+            // StatusNet's clients) that assume the Atom will conform to an
+            // older version of the Activity Streams API. Subject should be
+            // removed in future versions of StatusNet.
+
+            $this->addAuthorRaw($ao->asString('author'));
+
+            $depMsg = 'Deprecation warning: activity:subject is present '
+                . 'only for backward compatibility. It will be '
+                . 'removed in the next version of StatusNet.';
+
+            $this->addAuthorRaw(
+                "<!--$depMsg-->\n"
+                . $ao->asString('activity:subject')
+            );
         }
 
         // TRANS: Title in atom user notice feed. %s is a user name.
@@ -89,7 +109,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
                 array('nickname' => $user->nickname)
             )
         );
-        
+
         $self = common_local_url('ApiTimelineUser',
                                  array('id' => $user->id,
                                        'format' => 'atom'));