X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupshow.php;h=2998e505e2174325c244e63d730fe02420076bef;hb=f2d6e1e375410bee0efc90c80b1e74699a4c6b7d;hp=95d6f95afa8a18be770d5d8a0d00225563638d16;hpb=84e7c7783c3a781b6dc12335371c984eca8e43d8;p=quix0rs-gnu-social.git diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 95d6f95afa..2998e505e2 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -26,6 +26,7 @@ * @author Jeffery To * @author Zach Copley * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -45,6 +46,7 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @author Evan Prodromou * @author Jeffery To * @author Zach Copley + * @author Michele * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -68,6 +70,24 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->group = $this->getTargetGroup($this->arg('id')); + if (empty($this->group)) { + $alias = Group_alias::staticGet( + 'alias', + common_canonical_nickname($this->arg('id')) + ); + if (!empty($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; + } + return true; } @@ -85,15 +105,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction { parent::handle($args); - if (empty($this->group)) { - $this->clientError( - _('Group not found!'), - 404, - $this->format - ); - return; - } - switch($this->format) { case 'xml': $this->showSingleXmlGroup($this->group); @@ -105,7 +116,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->clientError(_('API method not found.'), 404, $this->format); break; } - } /**