Mods blocking (#8364)

* updated logic for blocking/unblocking

* updated 1 test and added 2
This commit is contained in:
Myles Louis Dakan
2017-02-06 00:32:10 -05:00
committed by Keith Holliday
parent 07ce68c596
commit dbb1e3aa18
2 changed files with 39 additions and 6 deletions

View File

@@ -177,10 +177,13 @@ api.updateHero = {
_.set(hero, updateData.itemPath, updateData.itemVal); // Sanitization at 5c30944 (deemed unnecessary)
}
if (updateData.auth && _.isBoolean(updateData.auth.blocked)) {
if (updateData.auth && updateData.auth.blocked === true) {
hero.auth.blocked = updateData.auth.blocked;
hero.preferences.sleep = true; // when blocking, have them rest at an inn to prevent damage
}
if (updateData.auth && updateData.auth.blocked === false) {
hero.auth.blocked = false;
}
if (updateData.flags && _.isBoolean(updateData.flags.chatRevoked)) hero.flags.chatRevoked = updateData.flags.chatRevoked;
let savedHero = await hero.save();