forked from GNUsocial/gnu-social
Resolve Group Aliases in showgroup.php
For Example, let's say 'alias' was an alias for the group 'group'. Previously, if you went to '/group/group' it'd work, but '/group/alias' it'd say "No Such Group". This was untrue. Now it checks aliases when it can't find a group with a given name. If it finds one it redirects you to the original group.
This commit is contained in:
parent
d647483a27
commit
b4c3453923
@ -130,8 +130,18 @@ class ShowgroupAction extends GroupDesignAction
|
|||||||
$this->group = User_group::staticGet('nickname', $nickname);
|
$this->group = User_group::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
if (!$this->group) {
|
if (!$this->group) {
|
||||||
$this->clientError(_('No such group'), 404);
|
$alias = Group_alias::staticGet('alias', $nickname);
|
||||||
return false;
|
if ($alias) {
|
||||||
|
$args = array('id' => $alias->group_id);
|
||||||
|
if ($this->page != 1) {
|
||||||
|
$args['page'] = $this->page;
|
||||||
|
}
|
||||||
|
common_redirect(common_local_url('groupbyid', $args), 301);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$this->clientError(_('No such group'), 404);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
common_set_returnto($this->selfUrl());
|
common_set_returnto($this->selfUrl());
|
||||||
|
Loading…
Reference in New Issue
Block a user