summaryrefslogtreecommitdiff
path: root/lib/apiaction.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-06-28 16:53:05 -0700
committerZach Copley <zach@status.net>2010-06-28 16:54:39 -0700
commit923d9ef71ce49bfa55460bf42acb8a35bf3e84be (patch)
tree22d931a56ffaf4d9565bdb1eb887b2f673bee47e /lib/apiaction.php
parentdcfe5b24f6047aa830f107628aa3c10b9d292951 (diff)
- Fix bugs with block and friendship API methods
- Friendship API methods now use a Profile instead of User for target
Diffstat (limited to 'lib/apiaction.php')
-rw-r--r--lib/apiaction.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 89a487102..8de13a62d 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -1374,6 +1374,34 @@ class ApiAction extends Action
}
}
+ function getTargetProfile($id)
+ {
+ if (empty($id)) {
+
+ // Twitter supports these other ways of passing the user ID
+ if (is_numeric($this->arg('id'))) {
+ return Profile::staticGet($this->arg('id'));
+ } else if ($this->arg('id')) {
+ $nickname = common_canonical_nickname($this->arg('id'));
+ return Profile::staticGet('nickname', $nickname);
+ } 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
+ if (is_numeric($this->arg('user_id'))) {
+ return Profile::staticGet('id', $this->arg('user_id'));
+ }
+ } else if ($this->arg('screen_name')) {
+ $nickname = common_canonical_nickname($this->arg('screen_name'));
+ return Profile::staticGet('nickname', $nickname);
+ }
+ } else if (is_numeric($id)) {
+ return Profile::staticGet($id);
+ } else {
+ $nickname = common_canonical_nickname($id);
+ return Profile::staticGet('nickname', $nickname);
+ }
+ }
+
function getTargetGroup($id)
{
if (empty($id)) {