From e272adb321fb72043ac7f9a16848ef9386e56571 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Thu, 22 Jan 2009 08:01:40 +0000 Subject: fixed a few bugs and logic problems in groups --- actions/leavegroup.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'actions/leavegroup.php') diff --git a/actions/leavegroup.php b/actions/leavegroup.php index 587208b36..c7152e3c0 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -57,12 +57,12 @@ class LeavegroupAction extends Action parent::prepare($args); if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); + $this->serverError(_('Inboxes must be enabled for groups to work.')); return false; } if (!common_logged_in()) { - $this->clientError(_('You must be logged in to join a group.')); + $this->clientError(_('You must be logged in to leave a group.')); return false; } @@ -78,24 +78,30 @@ class LeavegroupAction extends Action } if (!$nickname) { - $this->clientError(_('No nickname'), 404); + $this->clientError(_('No nickname.'), 404); return false; } $this->group = User_group::staticGet('nickname', $nickname); if (!$this->group) { - $this->clientError(_('No such group'), 404); + $this->clientError(_('No such group.'), 404); return false; } $cur = common_current_user(); - if (!$cur->isMember($group)) { - $this->clientError(_('You are not a member of that group'), 403); + if (!$cur->isMember($this->group)) { + $this->clientError(_('You are not a member of that group.'), 403); return false; } + if ($cur->isAdmin($this->group)) { + $this->clientError(_('You may not leave a group while you are its administrator.'), 403); + return false; + + } + return true; } @@ -150,4 +156,4 @@ class LeavegroupAction extends Action $this->group->nickname))); } } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf