}
try {
- if (Event::handle('StartJoinGroup', array($group, $cur))) {
- Group_member::join($group->id, $cur->id);
- Event::handle('EndJoinGroup', array($group, $cur));
- }
+ $cur->joinGroup($group);
} catch (Exception $e) {
// TRANS: Message given having failed to add a user to a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
}
try {
- if (Event::handle('StartLeaveGroup', array($group, $cur))) {
- Group_member::leave($group->id, $cur->id);
- Event::handle('EndLeaveGroup', array($group, $cur));
- }
+ $cur->leaveGroup($group);
} catch (Exception $e) {
// TRANS: Message given having failed to remove a user from a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
return;
}
- if ($this->user->getProfile()->hasRepeated($notice->id)) {
+ // Is it OK to repeat that notice (general enough scope)?
+
+ if ($notice->scope != Notice::SITE_SCOPE &&
+ $notice->scope != Notice::PUBLIC_SCOPE) {
+ // TRANS: Client error displayed when trying to repeat a private notice.
+ $channel->error($this->user, _('You may not repeat a private notice.'));
+ }
+
+ $profile = $this->user->getProfile();
+
+ // Can the profile actually see that notice?
+
+ if (!$notice->inScope($profile)) {
+ // TRANS: Client error displayed when trying to repeat a notice the user has no access to.
+ $channel->error($this->user, _('You have no access to that notice.'));
+ }
+
+ if ($profile->hasRepeated($notice->id)) {
// TRANS: Error text shown when trying to repeat an notice that was already repeated by the user.
$channel->error($this->user, _('Already repeated that notice.'));
return;