Merge branch 'master' of ssh://github.com/nylas/k2

This commit is contained in:
Ben Gotow 2016-07-12 18:33:33 -07:00
commit ea4d5d0054
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; const {Contact} = db;
this.logger = logger
let allContacts = [] let allContacts = []
const fields = ['to', 'from', 'bcc', 'cc'] 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."); throw new Error("Threading processMessage expects folder value to be present.");
} }
this.logger = logger
const {Folder, Label} = db; const {Folder, Label} = db;
let findOrCreateThread = null; let findOrCreateThread = null;
@ -140,13 +139,12 @@ class ThreadingProcessor {
isSent = !!message.labels.find(l => l.id === sentLabel.id) 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; thread.lastMessageSentDate = message.date;
} }
if (!isSent && (message.date > thread.lastMessageReceivedDate)) { if (!isSent && ((message.date > thread.lastMessageReceivedDate) || !thread.lastMessageReceivedDate)) {
thread.lastMessageReceivedDate = message.date; thread.lastMessageReceivedDate = message.date;
} }
// update folders and labels // update folders and labels
if (!thread.folders.find(f => f.id === message.folderId)) { if (!thread.folders.find(f => f.id === message.folderId)) {
thread.addFolder(message.folder) thread.addFolder(message.folder)