mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Release mergeback v3.86.0 (#8685)
* 3.85.0 * New User Tasks for Mobile (#8682) * feat(mobile): different default tasks * fix(linting): missing space * fix(user): correct client type logic * test(integration): tasks by platform * fix(test): remove only * test(user): deeper checks on tasks * refactor(test): whitespace for readability * feat(subs): Jackalope Pets (#8684) * chore(sprites): compile * chore(i18n): update locales * 3.86.0
This commit is contained in:
@@ -31,10 +31,16 @@ function findTag (user, tagName) {
|
||||
}
|
||||
|
||||
function _populateDefaultTasks (user, taskTypes) {
|
||||
let defaultsData;
|
||||
if (user.registeredThrough === 'habitica-android' || user.registeredThrough === 'habitica-ios') {
|
||||
defaultsData = shared.content.userDefaultsMobile;
|
||||
} else {
|
||||
defaultsData = shared.content.userDefaults;
|
||||
}
|
||||
let tagsI = taskTypes.indexOf('tag');
|
||||
|
||||
if (tagsI !== -1) {
|
||||
user.tags = _.map(shared.content.userDefaults.tags, (tag) => {
|
||||
user.tags = _.map(defaultsData.tags, (tag) => {
|
||||
let newTag = _.cloneDeep(tag);
|
||||
|
||||
// tasks automatically get _id=helpers.uuid() from TaskSchema id.default, but tags are Schema.Types.Mixed - so we need to manually invoke here
|
||||
@@ -53,7 +59,7 @@ function _populateDefaultTasks (user, taskTypes) {
|
||||
}
|
||||
|
||||
_.each(taskTypes, (taskType) => {
|
||||
let tasksOfType = _.map(shared.content.userDefaults[`${taskType}s`], (taskDefaults) => {
|
||||
let tasksOfType = _.map(defaultsData[`${taskType}s`], (taskDefaults) => {
|
||||
let newTask = new Tasks[taskType](taskDefaults);
|
||||
|
||||
newTask.userId = user._id;
|
||||
@@ -106,12 +112,17 @@ function _setUpNewUser (user) {
|
||||
user.flags.tutorial.common[section] = true;
|
||||
});
|
||||
} else {
|
||||
taskTypes = ['todo', 'tag'];
|
||||
user.flags.showTour = false;
|
||||
|
||||
_.each(iterableFlags.tour, (val, section) => {
|
||||
user.flags.tour[section] = -2;
|
||||
});
|
||||
|
||||
if (user.registeredThrough === 'habitica-android' || user.registeredThrough === 'habitica-ios') {
|
||||
taskTypes = ['habit', 'daily', 'todo', 'reward', 'tag'];
|
||||
} else {
|
||||
taskTypes = ['todo', 'tag'];
|
||||
}
|
||||
}
|
||||
|
||||
return _populateDefaultTasks(user, taskTypes);
|
||||
|
||||
Reference in New Issue
Block a user