mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Synced isdue/next due when user joins challenge (#9779)
This commit is contained in:
@@ -14,7 +14,7 @@ import shared from '../../common';
|
||||
import { sendTxn as txnEmail } from '../libs/email';
|
||||
import { sendNotification as sendPushNotification } from '../libs/pushNotifications';
|
||||
import cwait from 'cwait';
|
||||
import { syncableAttrs } from '../libs/taskManager';
|
||||
import { syncableAttrs, setNextDue } from '../libs/taskManager';
|
||||
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
@@ -145,6 +145,7 @@ schema.methods.syncToUser = async function syncChallengeToUser (user) {
|
||||
matchingTask.challenge = {taskId: chalTask._id, id: challenge._id, shortName: challenge.shortName};
|
||||
matchingTask.userId = user._id;
|
||||
user.tasksOrder[`${chalTask.type}s`].push(matchingTask._id);
|
||||
setNextDue(matchingTask, user);
|
||||
} else {
|
||||
_.merge(matchingTask, syncableAttrs(chalTask));
|
||||
// Make sure the task is in user.tasksOrder
|
||||
|
||||
Reference in New Issue
Block a user