mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
port updateTask, addTask, clearCompleted, taskDefaults, uuid
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
module.exports = function(user, req, cb) {
|
||||
_.remove(user.todos, function(t) {
|
||||
var ref;
|
||||
return t.completed && !((ref = t.challenge) != null ? ref.id : void 0);
|
||||
// TODO move to client since it's only used there?
|
||||
// TODO rename file to clearCompletedTodos
|
||||
|
||||
module.exports = function clearCompletedTodos (todos) {
|
||||
_.remove(todos, todo => {
|
||||
return todo.completed && (!todo.challenge || !todo.challenge.id || todo.challenge.broken);
|
||||
});
|
||||
if (typeof user.markModified === "function") {
|
||||
user.markModified('todos');
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, user.todos) : void 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user