mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Wrap task service in anon function
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
(function(){
|
||||
var TASK_KEYS_TO_REMOVE = ['_id', 'completed', 'date', 'dateCompleted', 'dateCreated', 'history', 'id', 'streak'];
|
||||
|
||||
angular
|
||||
.module('habitrpg')
|
||||
.factory('Tasks', tasksFactory);
|
||||
|
||||
tasksFactory.$inject = [
|
||||
tasksFactory.$inject = [
|
||||
'$rootScope',
|
||||
'Shared',
|
||||
'User'
|
||||
];
|
||||
];
|
||||
|
||||
function tasksFactory($rootScope, Shared, User) {
|
||||
function tasksFactory($rootScope, Shared, User) {
|
||||
|
||||
function editTask(task) {
|
||||
task._editing = !task._editing;
|
||||
@@ -27,8 +30,7 @@ function tasksFactory($rootScope, Shared, User) {
|
||||
}
|
||||
|
||||
function _cleanUpTask(task) {
|
||||
var keysToRemove = ['_id', 'completed', 'date', 'dateCompleted', 'dateCreated', 'history', 'id', 'streak'];
|
||||
var cleansedTask = _.omit(task, keysToRemove);
|
||||
var cleansedTask = _.omit(task, TASK_KEYS_TO_REMOVE);
|
||||
|
||||
// Copy checklists but reset to uncomplete and assign new id
|
||||
_(cleansedTask.checklist).forEach(function(item) {
|
||||
@@ -47,4 +49,5 @@ function tasksFactory($rootScope, Shared, User) {
|
||||
editTask: editTask,
|
||||
cloneTask: cloneTask
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user