summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-25 08:44:15 -0500
committerEvan Prodromou <evan@status.net>2010-02-25 08:44:15 -0500
commite6858d7203bd36923f6251968bede6f4b271bf84 (patch)
treedaf24ce51064058af226eb8e296476a3f9155473 /lib
parentddc3671b6aeb0b543d261251a1740a53469684c3 (diff)
modify group actions so they use Local_group to look up by nickname
Diffstat (limited to 'lib')
-rw-r--r--lib/api.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/api.php b/lib/api.php
index 0bcf4cc21..d79dc327e 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -1218,7 +1218,12 @@ class ApiAction extends Action
return User_group::staticGet($this->arg('id'));
} else if ($this->arg('id')) {
$nickname = common_canonical_nickname($this->arg('id'));
- return User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if (empty($local)) {
+ return null;
+ } else {
+ return User_group::staticGet('id', $local->id);
+ }
} else if ($this->arg('group_id')) {
// This is to ensure that a non-numeric user_id still
// overrides screen_name even if it doesn't get used
@@ -1227,14 +1232,24 @@ class ApiAction extends Action
}
} else if ($this->arg('group_name')) {
$nickname = common_canonical_nickname($this->arg('group_name'));
- return User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if (empty($local)) {
+ return null;
+ } else {
+ return User_group::staticGet('id', $local->id);
+ }
}
} else if (is_numeric($id)) {
return User_group::staticGet($id);
} else {
$nickname = common_canonical_nickname($id);
- return User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if (empty($local)) {
+ return null;
+ } else {
+ return User_group::staticGet('id', $local->id);
+ }
}
}