Merge branch 'develop' into api-v3
This commit is contained in:
@@ -354,7 +354,15 @@ api.update = (req, res, next) => {
|
||||
|
||||
user.save((err) => {
|
||||
if (!_.isEmpty(errors)) return res.json(401, {err: errors});
|
||||
if (err) return next(err);
|
||||
if (err) {
|
||||
if (err.name == 'ValidationError') {
|
||||
let errorMessages = _.map(_.values(err.errors), (error) => {
|
||||
return error.message;
|
||||
});
|
||||
return res.json(400, {err: errorMessages});
|
||||
}
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.json(200, user);
|
||||
user = errors = null;
|
||||
|
||||
@@ -308,6 +308,12 @@ api.updateTask = {
|
||||
throw new NotFound(res.t('taskNotFound'));
|
||||
}
|
||||
|
||||
// If reminders are updated -> replace the original ones
|
||||
if (req.body.reminders) {
|
||||
task.reminders = req.body.reminders;
|
||||
delete req.body.reminders;
|
||||
}
|
||||
|
||||
// If checklist is updated -> replace the original one
|
||||
if (req.body.checklist) {
|
||||
task.checklist = req.body.checklist;
|
||||
|
||||
Reference in New Issue
Block a user