]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
if the id is an alias we redirect using group_id
authorMichele <macno@macno.org>
Thu, 21 Jan 2010 18:30:12 +0000 (19:30 +0100)
committerZach Copley <zach@status.net>
Thu, 21 Jan 2010 18:39:07 +0000 (10:39 -0800)
actions/apigroupshow.php

index 7aa49b1bf37c71c77763ea781b199814eca6ed76..852428144430c99e307fa68011ce9ec6d2a748b7 100644 (file)
@@ -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;
         }