feat(flag-message): add server methods
This commit is contained in:
+13
-1
@@ -99,7 +99,7 @@ var chatDefaults = module.exports.chatDefaults = function(msg,user){
|
||||
text: msg,
|
||||
timestamp: +new Date,
|
||||
likes: {},
|
||||
flags: {} // for @paglias, @crookedneighbor added this.
|
||||
flags: {}
|
||||
};
|
||||
if (user) {
|
||||
_.defaults(message, {
|
||||
@@ -317,6 +317,18 @@ GroupSchema.statics.bossQuest = function(user, progress, cb) {
|
||||
})
|
||||
}
|
||||
|
||||
GroupSchema.methods.toJSON = function() {
|
||||
var doc = this.toObject();
|
||||
if(doc.chat){
|
||||
doc.chat.forEach(function(msg){
|
||||
msg.flags = {};
|
||||
});
|
||||
}
|
||||
|
||||
return doc;
|
||||
};
|
||||
|
||||
|
||||
module.exports.schema = GroupSchema;
|
||||
var Group = module.exports.model = mongoose.model("Group", GroupSchema);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user