diff options
author | Evan Prodromou <evan@status.net> | 2010-02-25 18:45:32 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-02-25 18:45:32 -0500 |
commit | 4aa82f75ed692e254c573096168e1cd7c0890ac6 (patch) | |
tree | 9fb87849f1f09c69c1c8e1a7c93d76fa283d5330 /actions/leavegroup.php | |
parent | 6578e0e1afed8e8738bbcb31d200927e10074f11 (diff) | |
parent | e254c660f66e1a04ac18220c95ef47aa88117e3c (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'actions/leavegroup.php')
-rw-r--r-- | actions/leavegroup.php | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/actions/leavegroup.php b/actions/leavegroup.php index 222d4c1b4..329b5aafe 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -62,30 +62,33 @@ class LeavegroupAction extends Action } $nickname_arg = $this->trimmed('nickname'); - $nickname = common_canonical_nickname($nickname_arg); - - // Permanent redirect on non-canonical nickname + $id = intval($this->arg('id')); + if ($id) { + $this->group = User_group::staticGet('id', $id); + } else if ($nickname_arg) { + $nickname = common_canonical_nickname($nickname_arg); + + // Permanent redirect on non-canonical nickname + + if ($nickname_arg != $nickname) { + $args = array('nickname' => $nickname); + common_redirect(common_local_url('leavegroup', $args), 301); + return false; + } - if ($nickname_arg != $nickname) { - $args = array('nickname' => $nickname); - common_redirect(common_local_url('leavegroup', $args), 301); - return false; - } + $local = Local_group::staticGet('nickname', $nickname); - if (!$nickname) { - $this->clientError(_('No nickname.'), 404); - return false; - } - - $local = Local_group::staticGet('nickname', $nickname); + if (!$local) { + $this->clientError(_('No such group.'), 404); + return false; + } - if (!$local) { - $this->clientError(_('No such group.'), 404); + $this->group = User_group::staticGet('id', $local->group_id); + } else { + $this->clientError(_('No nickname or ID.'), 404); return false; } - $this->group = User_group::staticGet('id', $local->group_id); - if (!$this->group) { $this->clientError(_('No such group.'), 404); return false; |