Fix population of db fields in processor

This commit is contained in:
Ben Gotow 2016-06-27 16:38:40 -07:00
parent 91887a6e11
commit f68948c23f
3 changed files with 4 additions and 2 deletions

View file

@ -7,7 +7,7 @@ global.NylasError = NylasError;
// List of the attributes of Message that the processor should be allowed to change.
// The message may move between folders, get starred, etc. while it's being
// processed, and it shouldn't overwrite changes to those fields.
const MessageAttributes = ['body', 'processed']
const MessageAttributes = ['body', 'processed', 'to', 'from', 'cc', 'bcc', 'snippet']
const MessageProcessorVersion = 1;
function runPipeline({db, accountId, message}) {

View file

@ -28,7 +28,6 @@ function processMessage({message}) {
}
// extract data from the raw headers object
message.messageId = message.headers['message-id'];
for (const field of ['to', 'from', 'cc', 'bcc']) {
message[field] = extractContacts(message.headers[field]);
}

View file

@ -188,6 +188,9 @@ class FetchMessagesInCategory {
headers: Imap.parseHeader(headers),
}
values.messageId = values.headers['message-id'][0];
values.subject = values.headers.subject[0];
Message.find({where: {hash}}).then((existing) => {
if (existing) {
Object.assign(existing, values);