mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
wip: split shared ops
This commit is contained in:
12
common/script/ops/clearCompleted.js
Normal file
12
common/script/ops/clearCompleted.js
Normal file
@@ -0,0 +1,12 @@
|
||||
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);
|
||||
});
|
||||
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