summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-25 13:02:08 -0800
committerBrion Vibber <brion@pobox.com>2010-02-25 13:02:08 -0800
commitb5b5184c885e74d9532409a5962f851c4baf41c4 (patch)
treeaaf0aae0468ff15bd61ad8f4234020ae40e1bd19 /actions
parent7e0872c7ca9827220ad9859abaeea268c9d4fee6 (diff)
OStatus: fix remote groups to work with new user_groups/local_groups split.
- fix <activity:subject> generation so we get the profile info (what's available so far) - use id instead of nickname for group join/leave forms so we can join/leave remote groups while the rest of the groups UI remains limited to local groups (plugins are responsible for making sure remote notifications and permission checks are done) - fix remote notification when joining group through OStatus's remote subscribe form
Diffstat (limited to 'actions')
-rw-r--r--actions/joingroup.php39
-rw-r--r--actions/leavegroup.php39
2 files changed, 42 insertions, 36 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;