]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' of gitorious.org:statusnet/mainline
authorEvan Prodromou <evan@status.net>
Fri, 11 Feb 2011 03:23:06 +0000 (22:23 -0500)
committerEvan Prodromou <evan@status.net>
Fri, 11 Feb 2011 03:23:06 +0000 (22:23 -0500)
lib/activity.php
lib/activityutils.php
plugins/OStatus/classes/Ostatus_profile.php

index 6c21c0bcc990ce397f6e4d7a76eb00a175a06584..17684d897bb608ee16f12ac7bc7320e72b6d2517 100644 (file)
@@ -205,18 +205,19 @@ class Activity
             // the surrounding feed.
             $this->actor = new ActivityObject($authorEl);
 
-        } else if (!empty($feed) && $authorEl = $this->_child($feed, self::AUTHOR,
-                                                              self::ATOM)) {
-
-            // If there's no <atom:author> on the entry, it's safe to assume
-            // the containing feed's authorship info applies.
-            $this->actor = new ActivityObject($authorEl);
         } else if (!empty($feed) &&
                    $subjectEl = $this->_child($feed, self::SUBJECT)) {
 
             // Feed subject is used for things like groups.
             // Should actually possibly not be interpreted as an actor...?
             $this->actor = new ActivityObject($subjectEl);
+
+        } else if (!empty($feed) && $authorEl = $this->_child($feed, self::AUTHOR,
+                                                              self::ATOM)) {
+
+            // If there's no <atom:author> on the entry, it's safe to assume
+            // the containing feed's authorship info applies.
+            $this->actor = new ActivityObject($authorEl);
         }
 
         $contextEl = $this->_child($entry, self::CONTEXT);
index 11befc0ed4774925c2b499eb540da72cc98324c0..3aa09deb4e7761f7812a0007506726d3f26baf02 100644 (file)
@@ -273,14 +273,6 @@ class ActivityUtils
 
     static function getFeedAuthor($feedEl)
     {
-        // Try the feed author
-
-        $author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM);
-
-        if (!empty($author)) {
-            return new ActivityObject($author);
-        }
-
         // Try old and deprecated activity:subject
 
         $subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
@@ -289,6 +281,14 @@ class ActivityUtils
             return new ActivityObject($subject);
         }
 
+        // Try the feed author
+
+        $author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM);
+
+        if (!empty($author)) {
+            return new ActivityObject($author);
+        }
+
         // Sheesh. Not a very nice feed! Let's try fingerpoken in the
         // entries.
 
@@ -298,14 +298,6 @@ class ActivityUtils
 
             $entry = $entries->item(0);
 
-            // Try the author
-
-            $author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM);
-
-            if (!empty($author)) {
-                return new ActivityObject($author);
-            }
-
             // Try the (deprecated) activity:actor
 
             $actor = ActivityUtils::child($entry, Activity::ACTOR, Activity::SPEC);
@@ -313,6 +305,14 @@ class ActivityUtils
             if (!empty($actor)) {
                 return new ActivityObject($actor);
             }
+
+            // Try the author
+
+            $author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM);
+
+            if (!empty($author)) {
+                return new ActivityObject($author);
+            }
         }
 
         return null;
index 28f2dc0a9774327a9875d35fb2df93e7cc18f398..c4d857f22cdb57a4baac1825519d7b48ac246fd9 100644 (file)
@@ -1354,7 +1354,17 @@ class Ostatus_profile extends Memcached_DataObject
     {
         $orig = clone($profile);
 
-        $profile->nickname = self::getActivityObjectNickname($object, $hints);
+        // Existing nickname is better than nothing.
+
+        if (!array_key_exists('nickname', $hints)) {
+            $hints['nickname'] = $profile->nickname;
+        }
+
+        $nickname = self::getActivityObjectNickname($object, $hints);
+
+        if (!empty($nickname)) {
+            $profile->nickname = $nickname;
+        }
 
         if (!empty($object->title)) {
             $profile->fullname = $object->title;
@@ -1370,9 +1380,23 @@ class Ostatus_profile extends Memcached_DataObject
             $profile->profileurl = $object->id;
         }
 
-        $profile->bio      = self::getActivityObjectBio($object, $hints);
-        $profile->location = self::getActivityObjectLocation($object, $hints);
-        $profile->homepage = self::getActivityObjectHomepage($object, $hints);
+        $bio = self::getActivityObjectBio($object, $hints);
+
+        if (!empty($bio)) {
+            $profile->bio = $bio;
+        }
+
+        $location = self::getActivityObjectLocation($object, $hints);
+
+        if (!empty($location)) {
+            $profile->location = $location;
+        }
+
+        $homepage = self::getActivityObjectHomepage($object, $hints);
+
+        if (!empty($homepage)) {
+            $profile->homepage = $homepage;
+        }
 
         if (!empty($object->geopoint)) {
             $location = ActivityContext::locationFromPoint($object->geopoint);