summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/joingroup.php39
-rw-r--r--actions/leavegroup.php39
-rw-r--r--actions/subscribe.php2
3 files changed, 43 insertions, 37 deletions
diff --git a/actions/joingroup.php b/actions/joingroup.php
index ba642f712..f87e5dae2 100644
--- a/actions/joingroup.php
+++ b/actions/joingroup.php
@@ -62,30 +62,33 @@ class JoingroupAction 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('joingroup', $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;
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;
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 3745311b6..b1243f393 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -145,7 +145,7 @@ class SubscribeAction extends Action
$this->element('title', null, _('Subscribed'));
$this->elementEnd('head');
$this->elementStart('body');
- $unsubscribe = new UnsubscribeForm($this, $this->other->getProfile());
+ $unsubscribe = new UnsubscribeForm($this, $this->other);
$unsubscribe->show();
$this->elementEnd('body');
$this->elementEnd('html');