mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix access to user.tasksOrder
This commit is contained in:
@@ -838,7 +838,7 @@ api.removeTagFromTask = {
|
||||
|
||||
// Remove a task from (user|challenge).tasksOrder
|
||||
function _removeTaskTasksOrder (userOrChallenge, taskId, taskType) {
|
||||
let list = userOrChallenge.tasksOrder[taskType];
|
||||
let list = userOrChallenge.tasksOrder[`${taskType}s`];
|
||||
let index = list.indexOf(taskId);
|
||||
|
||||
if (index !== -1) list.splice(index, 1);
|
||||
|
||||
@@ -660,7 +660,7 @@ schema.methods.unlinkChallengeTasks = async function unlinkChallengeTasks (chall
|
||||
tasks = tasks.map(task => {
|
||||
// Remove task from user.tasksOrder and delete them
|
||||
if (task.type !== 'todo' || !task.completed) {
|
||||
let list = user.tasksOrder[task.type];
|
||||
let list = user.tasksOrder[`${task.type}s`];
|
||||
let index = list.indexOf(task._id);
|
||||
if (index !== -1) list.splice(index, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user