feat(private-messages): add a "clear all" fn

This commit is contained in:
Tyler Renelle 2014-11-21 08:42:08 -07:00
parent 1bca160eb6
commit 03f47cd0aa
2 changed files with 11 additions and 0 deletions

View file

@ -14701,6 +14701,13 @@ api.wrap = function(user, main) {
}
return typeof cb === "function" ? cb(null, user.preferences.webhooks) : void 0;
},
clearPMs: function(req, cb) {
user.inbox.messages = {};
if (typeof user.markModified === "function") {
user.markModified('inbox.messages');
}
return typeof cb === "function" ? cb(null, user.inbox.messages) : void 0;
},
deletePM: function(req, cb) {
delete user.inbox.messages[req.params.id];
if (typeof user.markModified === "function") {

View file

@ -628,6 +628,10 @@ api.wrap = (user, main=true) ->
# ------
# Inbox
# ------
clearPMs: (req, cb) ->
user.inbox.messages = {}
user.markModified? 'inbox.messages'
cb? null, user.inbox.messages
deletePM: (req, cb) ->
delete user.inbox.messages[req.params.id]
user.markModified? 'inbox.messages.'+req.params.id