summaryrefslogtreecommitdiff
path: root/actions/leavegroup.php
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-01-22 08:01:40 +0000
committerRobin Millette <millette@plantard.controlezvous.ca>2009-01-22 08:01:40 +0000
commite272adb321fb72043ac7f9a16848ef9386e56571 (patch)
treeb6d5c3196597af65d2a86b80389d0510d7514658 /actions/leavegroup.php
parentc20d0612bf51cff523f55b12095e7213be94355e (diff)
fixed a few bugs and logic problems in groups
Diffstat (limited to 'actions/leavegroup.php')
-rw-r--r--actions/leavegroup.php20
1 files changed, 13 insertions, 7 deletions
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
+}