summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele <macno@macno.org>2010-01-21 19:30:12 +0100
committerZach Copley <zach@status.net>2010-01-21 10:39:07 -0800
commit383703d170c59baf0cae32b612e04b4d292d1880 (patch)
treeaa16c6bba4bea95c17666af1fd6af72947460a77
parent373206ac0042c37624844fb738ff869fa7190041 (diff)
if the id is an alias we redirect using group_id
-rw-r--r--actions/apigroupshow.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php
index 7aa49b1bf..852428144 100644
--- a/actions/apigroupshow.php
+++ b/actions/apigroupshow.php
@@ -85,12 +85,18 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
{
parent::handle($args);
- if (empty($this->group)) {
- $this->clientError(
- _('Group not found!'),
- 404,
- $this->format
- );
+ if (!$this->group) {
+ $alias = Group_alias::staticGet('alias', common_canonical_nickname($this->arg('id')));
+ if ($alias) {
+ $args = array('id' => $alias->group_id, 'format'=>$this->format);
+ common_redirect(common_local_url('ApiGroupShow', $args), 301);
+ } else {
+ $this->clientError(
+ _('Group not found!'),
+ 404,
+ $this->format
+ );
+ }
return;
}