add support for user._tmp, disable user.filters since it is not used

This commit is contained in:
Matteo Pagliazzi
2016-02-29 23:20:13 +01:00
parent a04bf4c045
commit e5224a7b2a
5 changed files with 44 additions and 12 deletions
+7 -8
View File
@@ -105,9 +105,10 @@ export let schema = new Schema({
},
balance: {type: Number, default: 0},
filters: {type: Schema.Types.Mixed, default: () => {
// Not saved on the user TODO remove with migration
/* filters: {type: Schema.Types.Mixed, default: () => {
return {};
}},
}}, */
purchased: {
ads: {type: Boolean, default: false},
@@ -516,13 +517,11 @@ schema.plugin(baseModel, {
'auth.local.salt', 'tasksOrder', 'tags', 'stats', 'challenges', 'guilds', 'party._id', 'party.quest',
'invitations', 'balance', 'backer', 'contributor'],
private: ['auth.local.hashed_password', 'auth.local.salt'],
toJSONTransform: function userToJSON (doc) {
// FIXME? Is this a reference to `doc.filters` or just disabled code? Remove?
// TODO this works?
// doc.filters = {};
// doc._tmp = this._tmp; // be sure to send down drop notifs
toJSONTransform: function userToJSON (plainObj, originalDoc) {
// doc.filters = {}; Not saved
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs TODO how to test?
return doc;
return plainObj;
},
});