fix open uid sort

This commit is contained in:
Andris Reinman 2018-01-04 10:10:01 +02:00
parent 1aeb66dbff
commit 7e18ad65a3

View file

@ -34,12 +34,13 @@ module.exports = server => (path, session, callback) => {
.project({
uid: true
})
.sort([['uid', 1]])
//.sort([['uid', 1]])
.toArray((err, messages) => {
if (err) {
return callback(err);
}
mailbox.uidList = messages.map(message => message.uid).sort((a, b) => a.uid - b.uid);
// sort and ensure unique UIDs
mailbox.uidList = Array.from(new Set(messages.map(message => message.uid))).sort((a, b) => a - b);
callback(null, mailbox);
});
}