mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-24 06:35:37 +00:00
Turn automaticAllocation to false when resetting or rebirthing
closes #7627 fixes #7620
This commit is contained in:
parent
c77f165b3e
commit
a58bf4ee2b
4 changed files with 36 additions and 0 deletions
|
|
@ -52,6 +52,8 @@ module.exports = function rebirth (user, tasks = [], req = {}, analytics) {
|
|||
stats.lvl = 1;
|
||||
stats.class = 'warrior';
|
||||
|
||||
user.preferences.automaticAllocation = false;
|
||||
|
||||
_.each(USERSTATSLIST, function resetStats (value) {
|
||||
stats[value] = 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ module.exports = function reset (user, tasks = [], req = {}) {
|
|||
|
||||
resetGear(user);
|
||||
|
||||
user.preferences.automaticAllocation = false;
|
||||
|
||||
if (req.v2 === true) {
|
||||
return user;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -233,4 +233,20 @@ describe('shared.ops.rebirth', () => {
|
|||
expect(user.achievements.rebirths).to.equal(2);
|
||||
expect(user.achievements.rebirthLevel).to.equal(MAX_LEVEL);
|
||||
});
|
||||
|
||||
it('keeps automaticAllocation false', () => {
|
||||
user.preferences.automaticAllocation = false;
|
||||
|
||||
rebirth(user);
|
||||
|
||||
expect(user.preferences.automaticAllocation).to.be.false;
|
||||
});
|
||||
|
||||
it('sets automaticAllocation to false when true', () => {
|
||||
user.preferences.automaticAllocation = true;
|
||||
|
||||
rebirth(user);
|
||||
|
||||
expect(user.preferences.automaticAllocation).to.be.false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,4 +76,20 @@ describe('shared.ops.reset', () => {
|
|||
expect(user.tasksOrder.dailys).to.be.empty;
|
||||
expect(user.tasksOrder.rewards).to.be.empty;
|
||||
});
|
||||
|
||||
it('keeps automaticAllocation false', () => {
|
||||
user.preferences.automaticAllocation = false;
|
||||
|
||||
reset(user);
|
||||
|
||||
expect(user.preferences.automaticAllocation).to.be.false;
|
||||
});
|
||||
|
||||
it('sets automaticAllocation to false when true', () => {
|
||||
user.preferences.automaticAllocation = true;
|
||||
|
||||
reset(user);
|
||||
|
||||
expect(user.preferences.automaticAllocation).to.be.false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue