]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Additional fixes found while looking at ticket #2532: when given a screen name as...
authorBrion Vibber <brion@pobox.com>
Fri, 22 Oct 2010 20:53:10 +0000 (13:53 -0700)
committerBrion Vibber <brion@pobox.com>
Fri, 22 Oct 2010 20:53:10 +0000 (13:53 -0700)
lib/apiaction.php

index afba8ab634b9f0009e5ea0ef7c7fdfb73f56ea7a..4e9dbb310bcfc4e10253c5b39e59840ba009eae3 100644 (file)
@@ -1398,8 +1398,10 @@ class ApiAction extends Action
             if (is_numeric($this->arg('id'))) {
                 return Profile::staticGet($this->arg('id'));
             } else if ($this->arg('id')) {
+                // Screen names currently can only uniquely identify a local user.
                 $nickname = common_canonical_nickname($this->arg('id'));
-                return Profile::staticGet('nickname', $nickname);
+                $user = User::staticGet('nickname', $nickname);
+                return $user ? $user->getProfile() : null;
             } else if ($this->arg('user_id')) {
                 // This is to ensure that a non-numeric user_id still
                 // overrides screen_name even if it doesn't get used
@@ -1408,13 +1410,15 @@ class ApiAction extends Action
                 }
             } else if ($this->arg('screen_name')) {
                 $nickname = common_canonical_nickname($this->arg('screen_name'));
-                return Profile::staticGet('nickname', $nickname);
+                $user = User::staticGet('nickname', $nickname);
+                return $user ? $user->getProfile() : null;
             }
         } else if (is_numeric($id)) {
             return Profile::staticGet($id);
         } else {
             $nickname = common_canonical_nickname($id);
-            return Profile::staticGet('nickname', $nickname);
+            $user = User::staticGet('nickname', $nickname);
+            return $user ? $user->getProfile() : null;
         }
     }