From 13cf744fb3979342401a947f06dc2aca7588ab28 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 8 Feb 2016 11:38:52 +0100 Subject: [PATCH] Allow screennames that are === '0' --- lib/apiaction.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/apiaction.php b/lib/apiaction.php index 24f42e4a41..16c375ee12 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -1404,20 +1404,21 @@ class ApiAction extends Action if (self::is_decimal($this->arg('user_id'))) { return Profile::getKV('id', $this->arg('user_id')); } - } else if ($this->arg('screen_name')) { + } elseif (mb_strlen($this->arg('screen_name')) > 0) { $nickname = common_canonical_nickname($this->arg('screen_name')); - $user = User::getKV('nickname', $nickname); - return $user instanceof User ? $user->getProfile() : null; + $user = User::getByNickname($nickname); + return $user->getProfile(); } else { // Fall back to trying the currently authenticated user return $this->scoped; } - } else if (self::is_decimal($id)) { - return Profile::getKV($id); + } else if (self::is_decimal($id) && intval($id) > 0) { + return Profile::getByID($id); } else { + // FIXME: check if isAcct to identify remote profiles and not just local nicknames $nickname = common_canonical_nickname($id); - $user = User::getKV('nickname', $nickname); - return $user ? $user->getProfile() : null; + $user = User::getByNickname($nickname); + return $user->getProfile(); } } @@ -1564,4 +1565,4 @@ class ApiAction extends Action return $uri; } -} \ No newline at end of file +} -- 2.39.5