summaryrefslogtreecommitdiff
path: root/actions/leavegroup.php
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/leavegroup.php
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/leavegroup.php')
-rw-r--r--actions/leavegroup.php39
1 files changed, 21 insertions, 18 deletions
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;