mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
[#1741] remove _id from TaskSchema (we're too deep in our legacy task.id
requirement, we can revisit later)
This commit is contained in:
@@ -201,6 +201,13 @@ var UserSchema = new Schema({
|
||||
minimize: false // So empty objects are returned
|
||||
});
|
||||
|
||||
UserSchema.methods.deleteTask = function(tid) {
|
||||
//user[t.type+'s'].id(t.id).remove();
|
||||
var task = this.tasks[tid];
|
||||
var i = this[task.type+'s'].indexOf(task);
|
||||
if (~i) this[task.type+'s'].splice(i,1);
|
||||
}
|
||||
|
||||
UserSchema.methods.toJSON = function() {
|
||||
var doc = this.toObject();
|
||||
doc.id = doc._id;
|
||||
@@ -209,12 +216,6 @@ UserSchema.methods.toJSON = function() {
|
||||
doc.filters = {};
|
||||
doc._tmp = this._tmp; // be sure to send down drop notifs
|
||||
|
||||
_.each(['habits','dailys','todos','rewards'], function(type){
|
||||
_.each(doc[type],function(task){
|
||||
task.id = task.id || task._id;
|
||||
})
|
||||
})
|
||||
|
||||
return doc;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user