mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 21:55:54 +08:00
Update threading and fix typo
This commit is contained in:
parent
a917022505
commit
ae54192ed6
2 changed files with 13 additions and 7 deletions
|
@ -21,11 +21,8 @@ function addMessageToThread({db, accountId, message}) {
|
|||
|
||||
function matchThread({db, accountId, message}) {
|
||||
const {Thread} = db
|
||||
|
||||
// TODO: Add once we have some test data with this header
|
||||
/*
|
||||
if (message.headers['in-reply-to']) {
|
||||
return getThreadFromHeader() // Doesn't exist yet
|
||||
if (message.headers.references) {
|
||||
return getThreadFromReferences()
|
||||
.then((thread) => {
|
||||
if (thread) {
|
||||
return thread
|
||||
|
@ -36,13 +33,22 @@ function matchThread({db, accountId, message}) {
|
|||
})
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
return Thread.create({
|
||||
subject: message.subject,
|
||||
cleanedSubject: cleanSubject(message.subject),
|
||||
})
|
||||
}
|
||||
|
||||
function getThreadFromReferences({db, references}) {
|
||||
const {Message} = db
|
||||
const messageId = references.split()[references.length - 1]
|
||||
return Message.find({where: {messageId: messageId}})
|
||||
.then((message) => {
|
||||
return message.getThread()
|
||||
})
|
||||
}
|
||||
|
||||
function cleanSubject(subject) {
|
||||
if (subject === null) {
|
||||
return ""
|
||||
|
|
|
@ -10,7 +10,7 @@ DatabaseConnector.forShared().then((db) => {
|
|||
Account.findAll().then((accounts) => {
|
||||
if (accounts.length === 0) {
|
||||
console.log(`Couldn't find any accounts to sync. Run this CURL command to auth one!`)
|
||||
console.log(`curl -X POST -H "Content-Type: application/json" -d '{"email":"inboxapptest2@fastmail.fm", "name":"Ben Gotow", "provider":"imap", "settings":{"imap_username":"inboxapptest1@fastmail.fm","imap_host":"mail.amessagingengine.com","imap_port":993,"smtp_host":"mail.messagingengine.com","smtp_port":0,"smtp_username":"inboxapptest1@fastmail.fm", "smtp_password":"trar2e","imap_password":"trar2e","ssl_required":true}}' "http://localhost:5100/auth?client_id=123"`)
|
||||
console.log(`curl -X POST -H "Content-Type: application/json" -d '{"email":"inboxapptest2@fastmail.fm", "name":"Ben Gotow", "provider":"imap", "settings":{"imap_username":"inboxapptest1@fastmail.fm","imap_host":"mail.messagingengine.com","imap_port":993,"smtp_host":"mail.messagingengine.com","smtp_port":0,"smtp_username":"inboxapptest1@fastmail.fm", "smtp_password":"trar2e","imap_password":"trar2e","ssl_required":true}}' "http://localhost:5100/auth?client_id=123"`)
|
||||
}
|
||||
manager.ensureAccountIDsInRedis(accounts.map(a => a.id)).then(() => {
|
||||
manager.start();
|
||||
|
|
Loading…
Add table
Reference in a new issue