use addtoset for marking messages as seen

This commit is contained in:
Andris Reinman 2017-03-12 13:59:58 +02:00
parent e36fd11ebf
commit 1b0b0eab50

View file

@ -870,13 +870,15 @@ server.onFetch = function (path, options, session, callback) {
return processNext();
}
this.logger.debug('[%s] UPDATE FLAGS for "%s"', session.id, message.uid);
message.flags.unshift('\\Seen');
database.collection('messages').findOneAndUpdate({
_id: message._id
}, {
$set: {
flags: message.flags
$addToSet: {
flags: '\\Seen'
}
}, {}, err => {
if (err) {