if the id is an alias we redirect using group_id

This commit is contained in:
Michele 2010-01-21 19:30:12 +01:00 committed by Zach Copley
parent 373206ac00
commit 383703d170
1 changed files with 12 additions and 6 deletions

View 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;
}