Ordered inbox messages chronologically

This commit is contained in:
Annie 2016-07-12 18:31:30 -07:00
parent e658f066dd
commit 17f920fb90
2 changed files with 3 additions and 6 deletions

View file

@ -27,9 +27,8 @@ class ContactProcessor {
}
processMessage({db, message, logger}) {
processMessage({db, message}) {
const {Contact} = db;
this.logger = logger
let allContacts = []
const fields = ['to', 'from', 'bcc', 'cc']

View file

@ -77,7 +77,6 @@ class ThreadingProcessor {
throw new Error("Threading processMessage expects folder value to be present.");
}
this.logger = logger
const {Folder, Label} = db;
let findOrCreateThread = null;
@ -140,13 +139,12 @@ class ThreadingProcessor {
isSent = !!message.labels.find(l => l.id === sentLabel.id)
}
if (isSent && (message.date > thread.lastMessageSentDate)) {
if (isSent && ((message.date > thread.lastMessageSentDate) || !thread.lastMessageSentDate)) {
thread.lastMessageSentDate = message.date;
}
if (!isSent && (message.date > thread.lastMessageReceivedDate)) {
if (!isSent && ((message.date > thread.lastMessageReceivedDate) || !thread.lastMessageReceivedDate)) {
thread.lastMessageReceivedDate = message.date;
}
// update folders and labels
if (!thread.folders.find(f => f.id === message.folderId)) {
thread.addFolder(message.folder)