mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
v3 adapt v2: remove references to sanitizeCreate and fix tests
This commit is contained in:
@@ -33,13 +33,13 @@ describe('PUT /user/tasks/:id', () => {
|
||||
text: 'new text',
|
||||
notes: 'new notes',
|
||||
value: 10000,
|
||||
priority: 0.5,
|
||||
priority: 0.1,
|
||||
attribute: 'str',
|
||||
}).then((updatedTask) => {
|
||||
expect(updatedTask.text).to.eql('new text');
|
||||
expect(updatedTask.notes).to.eql('new notes');
|
||||
expect(updatedTask.value).to.eql(10000);
|
||||
expect(updatedTask.priority).to.eql(0.5);
|
||||
expect(updatedTask.priority).to.eql(0.1);
|
||||
expect(updatedTask.attribute).to.eql('str');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ api.create = async function(req, res, next){
|
||||
.concat(req.body.dailys).concat(req.body.todos);
|
||||
|
||||
chalTasks = chalTasks.map(function(task) {
|
||||
var newTask = new Tasks[task.type](Tasks.Task.sanitizeCreate(task));
|
||||
var newTask = new Tasks[task.type](Tasks.Task.sanitize(task));
|
||||
newTask.challenge.id = challenge._id;
|
||||
return newTask.save();
|
||||
});
|
||||
|
||||
@@ -853,7 +853,7 @@ api.addTask = function(req, res, next) {
|
||||
req.body.text = req.body.text || 'text';
|
||||
req.body = Tasks.Task.fromJSONV2(req.body);
|
||||
|
||||
var task = new Tasks[req.body.type](Tasks.Task.sanitizeCreate(req.body));
|
||||
var task = new Tasks[req.body.type](Tasks.Task.sanitize(req.body));
|
||||
|
||||
task.userId = user._id;
|
||||
user.tasksOrder[task.type + 's'].unshift(task._id);
|
||||
|
||||
Reference in New Issue
Block a user