]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Reinstate profile_info in author/actor
authorZach Copley <zach@status.net>
Fri, 18 Feb 2011 03:02:57 +0000 (19:02 -0800)
committerZach Copley <zach@status.net>
Fri, 18 Feb 2011 03:02:57 +0000 (19:02 -0800)
classes/Notice.php
classes/Profile.php
lib/activity.php
lib/activitystreamjsondocument.php
lib/atomusernoticefeed.php

index 007eb55f858c9918b95d408581538be074489ac8..95b3d5b48075e2ca1e51c075a2c6259210f40840 100644 (file)
@@ -1250,7 +1250,7 @@ class Notice extends Memcached_DataObject
      * @return Activity activity object representing this Notice.
      */
 
-    function asActivity()
+    function asActivity($cur)
     {
         $act = self::cacheGet(Cache::codeKey('notice:as-activity:'.$this->id));
 
@@ -1262,9 +1262,11 @@ class Notice extends Memcached_DataObject
         if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
 
             $profile = $this->getProfile();
-            $act->actor     = ActivityObject::fromProfile($profile);
-            $act->verb      = ActivityVerb::POST;
-            $act->objects[] = ActivityObject::fromNotice($this);
+
+            $act->actor            = ActivityObject::fromProfile($profile);
+            $act->actor->extra[]   = $profile->profileInfo($cur);
+            $act->verb             = ActivityVerb::POST;
+            $act->objects[]        = ActivityObject::fromNotice($this);
 
             // XXX: should this be handled by default processing for object entry?
 
@@ -1402,7 +1404,7 @@ class Notice extends Memcached_DataObject
                          $author=true,
                          $cur=null)
     {
-        $act = $this->asActivity();
+        $act = $this->asActivity($cur);
         $act->extra[] = $this->noticeInfo($cur);
         return $act->asString($namespace, $author, $source);
     }
index bdac3ba453aa6e09dfd1e247aff7b98b30a1ac71..ad01581d5ffc49e5f57e310278ca9396baad2373 100644 (file)
@@ -932,12 +932,12 @@ class Profile extends Memcached_DataObject
      *
      * @param User $cur Current user
      *
-     * @return array representation of <statusnet:profile_info> element
+     * @return array representation of <statusnet:profile_info> element or null
      */
 
     function profileInfo($cur)
     {
-        $profileInfoAttr = array();
+        $profileInfoAttr = array('local_id' => $this->id);
 
         if ($cur != null) {
             // Whether the current user is a subscribed to this profile
index b9bd8c31fe7427cb4475e7fd1d51970840e4b16a..a8e6d25af955281c33244ab3be419a38fd73a96b 100644 (file)
@@ -443,9 +443,10 @@ class Activity
 
         foreach ($this->extra as $e) {
             list($objectName, $props, $txt) = $e;
-            $activity[$objectName] = $props;
+            if (!empty($objectName)) {
+                $activity[$objectName] = $props;
+            }
         }
-
         return array_filter($activity);
     }
 
index 7e06652a45f989918c5a709d74a2aa55ccaeef9a..f74bb6d2e6d93bb0a0587e6e189931cc9387bb4c 100644 (file)
@@ -92,7 +92,6 @@ class ActivityStreamJSONDocument
 
     function addItemsFromNotices($notices)
     {
-        common_debug("addItemsFromNotices");
         if (is_array($notices)) {
             foreach ($notices as $notice) {
                 $this->addItemFromNotice($notice);
@@ -114,7 +113,7 @@ class ActivityStreamJSONDocument
     {
         $cur = empty($this->cur) ? common_current_user() : $this->cur;
 
-        $act          = $notice->asActivity();
+        $act          = $notice->asActivity($cur);
         $act->extra[] = $notice->noticeInfo($cur);
 
         array_push($this->doc['items'], $act->asArray());
index 3398cc8b4d88e48af695b28c836010a47618f285..fb0ac5f8313c88cd80504cfca650fb393d4a8d8d 100644 (file)
@@ -64,7 +64,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
 
             $ao = ActivityObject::fromProfile($profile);
 
-            $ao->extra[] = $profile->profileInfo($cur);
+            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