mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-01 02:25:45 +08:00
Merge branch 'master' of github.com:nylas/k2
This commit is contained in:
commit
c7fa9a782f
5 changed files with 20 additions and 5 deletions
|
@ -50,6 +50,10 @@ const validate = (request, username, password, callback) => {
|
|||
return
|
||||
}
|
||||
token.getAccount().then((account) => {
|
||||
if (!account) {
|
||||
callback(new Error("Could not find Account referenced by AccountToken"), false, {});
|
||||
return;
|
||||
}
|
||||
SchedulerUtils.notifyAccountIsActive(account.id)
|
||||
callback(null, true, account);
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
from: JSONARRAYType('from'),
|
||||
cc: JSONARRAYType('cc'),
|
||||
bcc: JSONARRAYType('bcc'),
|
||||
replyTo: JSONARRAYType('replyTo'),
|
||||
categoryUID: { type: Sequelize.STRING, allowNull: true},
|
||||
}, {
|
||||
indexes: [
|
||||
|
@ -72,6 +73,11 @@ module.exports = (sequelize, Sequelize) => {
|
|||
body: this.body,
|
||||
subject: this.subject,
|
||||
snippet: this.snippet,
|
||||
to: this.to,
|
||||
from: this.from,
|
||||
cc: this.cc,
|
||||
bcc: this.bcc,
|
||||
reply_to: this.replyTo,
|
||||
date: this.date.getTime() / 1000.0,
|
||||
unread: this.unread,
|
||||
starred: this.starred,
|
||||
|
|
|
@ -15,6 +15,10 @@ module.exports = (sequelize, Sequelize) => {
|
|||
lastMessageSentDate: Sequelize.DATE,
|
||||
participants: JSONARRAYType('participants'),
|
||||
}, {
|
||||
indexes: [
|
||||
{ fields: ['subject'] },
|
||||
{ fields: ['threadId'] },
|
||||
],
|
||||
classMethods: {
|
||||
associate: ({Category, Message, ThreadCategory}) => {
|
||||
Thread.belongsToMany(Category, {through: ThreadCategory})
|
||||
|
|
|
@ -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', 'to', 'from', 'cc', 'bcc', 'snippet', 'threadId']
|
||||
const MessageAttributes = ['body', 'processed', 'to', 'from', 'cc', 'replyTo', 'bcc', 'snippet', 'threadId']
|
||||
const MessageProcessorVersion = 1;
|
||||
|
||||
function runPipeline({db, accountId, message}) {
|
||||
|
|
|
@ -27,10 +27,11 @@ function processMessage({message}) {
|
|||
console.log("Received message has no body or snippet.")
|
||||
}
|
||||
|
||||
// extract data from the raw headers object
|
||||
for (const field of ['to', 'from', 'cc', 'bcc']) {
|
||||
message[field] = extractContacts(message.headers[field]);
|
||||
}
|
||||
message.to = extractContacts(message.headers.to);
|
||||
message.cc = extractContacts(message.headers.cc);
|
||||
message.bcc = extractContacts(message.headers.bcc);
|
||||
message.from = extractContacts(message.headers.from);
|
||||
message.replyTo = extractContacts(message.headers['reply-to']);
|
||||
|
||||
return Promise.resolve(message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue