Fix promotions/demotions

This commit is contained in:
Luck 2016-07-19 17:10:40 +01:00
parent f24562c642
commit 1870893fe1
2 changed files with 8 additions and 4 deletions

View File

@ -65,9 +65,11 @@ public class UserDemote extends UserSubCommand {
try {
user.unsetPermission("group." + old);
} catch (ObjectLacksException ignored) {}
try {
user.addGroup(previousGroup);
user.setPrimaryGroup(previousGroup.getName());
} catch (ObjectLacksException | ObjectAlreadyHasException ignored) {}
} catch (ObjectAlreadyHasException ignored) {}
user.setPrimaryGroup(previousGroup.getName());
Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getName());
Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getName(), previousGroup.getName());

View File

@ -65,9 +65,11 @@ public class UserPromote extends UserSubCommand {
try {
user.unsetPermission("group." + old);
} catch (ObjectLacksException ignored) {}
try {
user.addGroup(nextGroup);
user.setPrimaryGroup(nextGroup.getName());
} catch (ObjectLacksException | ObjectAlreadyHasException ignored) {}
} catch (ObjectAlreadyHasException ignored) {}
user.setPrimaryGroup(nextGroup.getName());
Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getName());
Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getName(), nextGroup.getName());