summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-25 18:45:32 -0500
committerEvan Prodromou <evan@status.net>2010-02-25 18:45:32 -0500
commit4aa82f75ed692e254c573096168e1cd7c0890ac6 (patch)
tree9fb87849f1f09c69c1c8e1a7c93d76fa283d5330 /actions
parent6578e0e1afed8e8738bbcb31d200927e10074f11 (diff)
parente254c660f66e1a04ac18220c95ef47aa88117e3c (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
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');