mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Blocking a user makes them sleep Fixes #7935
Blocking a user will make the user rest at an inn, the user will remain resting when unblocked
This commit is contained in:
@@ -68,6 +68,7 @@ describe('PUT /heroes/:heroId', () => {
|
|||||||
expect(hero.contributor.level).to.equal(1);
|
expect(hero.contributor.level).to.equal(1);
|
||||||
expect(hero.purchased.ads).to.equal(true);
|
expect(hero.purchased.ads).to.equal(true);
|
||||||
expect(hero.auth.blocked).to.equal(true);
|
expect(hero.auth.blocked).to.equal(true);
|
||||||
|
expect(hero.preferences.sleep).to.equal(true);
|
||||||
expect(hero.notifications.length).to.equal(1);
|
expect(hero.notifications.length).to.equal(1);
|
||||||
expect(hero.notifications[0].type).to.equal('NEW_CONTRIBUTOR_LEVEL');
|
expect(hero.notifications[0].type).to.equal('NEW_CONTRIBUTOR_LEVEL');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -169,7 +169,10 @@ api.updateHero = {
|
|||||||
_.set(hero, updateData.itemPath, updateData.itemVal); // Sanitization at 5c30944 (deemed unnecessary)
|
_.set(hero, updateData.itemPath, updateData.itemVal); // Sanitization at 5c30944 (deemed unnecessary)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateData.auth && _.isBoolean(updateData.auth.blocked)) hero.auth.blocked = updateData.auth.blocked;
|
if (updateData.auth && _.isBoolean(updateData.auth.blocked)) {
|
||||||
|
hero.auth.blocked = updateData.auth.blocked;
|
||||||
|
hero.preferences.sleep = true; // when blocking, have them rest at an inn to prevent damage
|
||||||
|
}
|
||||||
if (updateData.flags && _.isBoolean(updateData.flags.chatRevoked)) hero.flags.chatRevoked = updateData.flags.chatRevoked;
|
if (updateData.flags && _.isBoolean(updateData.flags.chatRevoked)) hero.flags.chatRevoked = updateData.flags.chatRevoked;
|
||||||
|
|
||||||
let savedHero = await hero.save();
|
let savedHero = await hero.save();
|
||||||
|
|||||||
Reference in New Issue
Block a user