From 4cbda6818c599907ab04bdbdf49218737d20b73f Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Thu, 5 Nov 2015 13:08:37 -0600 Subject: [PATCH] Correct code to not iterate over mongoose object --- website/src/models/user.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/website/src/models/user.js b/website/src/models/user.js index 61fe6bd140..e36bedef11 100644 --- a/website/src/models/user.js +++ b/website/src/models/user.js @@ -580,7 +580,22 @@ function _populateDefaultsForNewUser(user) { if (user.registeredThrough === "habitica-web") { taskTypes = ['habits', 'dailys', 'todos', 'rewards', 'tags']; - _.each(user.flags.tutorial.common, function(value, section) { + var tutorialCommonSections = [ + 'habits', + 'dailies', + 'todos', + 'rewards', + 'party', + 'pets', + 'gems', + 'skills', + 'classes', + 'tavern', + 'equipment', + 'items', + ]; + + _.each(tutorialCommonSections, function(section) { user.flags.tutorial.common[section] = true; }); } else { @@ -588,7 +603,23 @@ function _populateDefaultsForNewUser(user) { user.flags.showTour = false; - _.each(user.flags.tour, function(value, section) { + var tourSections = [ + 'showTour', + 'intro', + 'classes', + 'stats', + 'tavern', + 'party', + 'guilds', + 'challenges', + 'market', + 'pets', + 'mounts', + 'hall', + 'equipment', + ]; + + _.each(tourSections, function(section) { user.flags.tour[section] = -2; }); }