Switch things from calling Group_member::join & leave & calling events manually to running through Profile::joinGroup() && Profile::leaveGroup(), with the events encapsulated.

This commit is contained in:
Brion Vibber
2011-03-21 14:35:29 -07:00
parent 0bec9cfdbc
commit 541dfa04fe
17 changed files with 81 additions and 70 deletions

View File

@@ -352,10 +352,7 @@ class JoinCommand extends Command
}
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.
@@ -400,10 +397,7 @@ class DropCommand extends Command
}
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.