mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
WIP: Improve User model performances (#10832)
* wip: define items as mixed objects * add default owned gear * mark modified * more mark modified * more mark modified * more mark modified * more mark modified * fix common tests * fix common tests * update mongoose * add itemsUtils * use new util function in hall controller * add tests for items utils * update website/server to mark all items as modified * start updating common code * update login incentives * update unlock * remove changes to package-lock.json * remove changes to package.json
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = function resetGear (user) {
|
||||
gear[type].shield = 'shield_base_0';
|
||||
});
|
||||
|
||||
// Gear.owned is a Mongo object so the _.each function iterates over hidden properties.
|
||||
// Gear.owned is (was) a Mongo object so the _.each function iterates over hidden properties.
|
||||
// The content.gear.flat[k] check should prevent this causing an error
|
||||
each(gear.owned, function resetOwnedGear (v, k) {
|
||||
if (gear.owned[k] && content.gear.flat[k] && content.gear.flat[k].value) {
|
||||
@@ -21,5 +21,7 @@ module.exports = function resetGear (user) {
|
||||
});
|
||||
|
||||
gear.owned.weapon_warrior_0 = true; // eslint-disable-line camelcase
|
||||
if (user.markModified) user.markModified('items.gear.owned');
|
||||
|
||||
user.preferences.costume = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user