]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/actions/groupsalmon.php
Complete "people tag" to "list" in UI messages.
[quix0rs-gnu-social.git] / plugins / OStatus / actions / groupsalmon.php
index 024f0cc217a6000cb56cda8526bb601e7bcf90b1..d03803d620ee12f3f8975ed403515517c126cde9 100644 (file)
@@ -53,7 +53,7 @@ class GroupsalmonAction extends SalmonAction
         $oprofile = Ostatus_profile::staticGet('group_id', $id);
         if ($oprofile) {
             // TRANS: Client error.
-            $this->clientError(_m("Can't accept remote posts for a remote group."));
+            $this->clientError(_m('Cannot accept remote posts for a remote group.'));
         }
 
         return true;
@@ -74,7 +74,7 @@ class GroupsalmonAction extends SalmonAction
             break;
         default:
             // TRANS: Client exception.
-            throw new ClientException("Can't handle that kind of post.");
+            throw new ClientException('Cannot handle that kind of post.');
         }
 
         // Notice must be to the attention of this group
@@ -127,11 +127,11 @@ class GroupsalmonAction extends SalmonAction
         $oprofile = $this->ensureProfile();
         if (!$oprofile) {
             // TRANS: Client error.
-            $this->clientError(_m("Can't read profile to set up group membership."));
+            $this->clientError(_m('Cannot read profile to set up group membership.'));
         }
         if ($oprofile->isGroup()) {
             // TRANS: Client error.
-            $this->clientError(_m("Groups can't join groups."));
+            $this->clientError(_m('Groups cannot join groups.'));
         }
 
         common_log(LOG_INFO, "Remote profile {$oprofile->uri} joining local group {$this->group->nickname}");
@@ -149,14 +149,7 @@ class GroupsalmonAction extends SalmonAction
         }
 
         try {
-            // @fixme that event currently passes a user from main UI
-            // Event should probably move into Group_member::join
-            // and take a Profile object.
-            //
-            //if (Event::handle('StartJoinGroup', array($this->group, $profile))) {
-                Group_member::join($this->group->id, $profile->id);
-                //Event::handle('EndJoinGroup', array($this->group, $profile));
-            //}
+            $profile->joinGroup($this->group);
         } catch (Exception $e) {
             // TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
             $this->serverError(sprintf(_m('Could not join remote user %1$s to group %2$s.'),
@@ -171,21 +164,17 @@ class GroupsalmonAction extends SalmonAction
     {
         $oprofile = $this->ensureProfile();
         if (!$oprofile) {
-            $this->clientError(_m("Can't read profile to cancel group membership."));
+            $this->clientError(_m('Cannot read profile to cancel group membership.'));
         }
         if ($oprofile->isGroup()) {
-            $this->clientError(_m("Groups can't join groups."));
+            $this->clientError(_m('Groups cannot join groups.'));
         }
 
         common_log(LOG_INFO, "Remote profile {$oprofile->uri} leaving local group {$this->group->nickname}");
         $profile = $oprofile->localProfile();
 
         try {
-            // @fixme event needs to be refactored as above
-            //if (Event::handle('StartLeaveGroup', array($this->group, $profile))) {
-                Group_member::leave($this->group->id, $profile->id);
-                //Event::handle('EndLeaveGroup', array($this->group, $profile));
-            //}
+            $profile->leaveGroup($this->group);
         } catch (Exception $e) {
             // TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
             $this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'),