[local-sync, iso-core] Don't treat inline images as attachments

Summary:
Don't show the attachment icon on threads that only have inline
images. We do this by assuming that inline images have a contentID,
and regular attachments do not. Also updates the way we send
attachments in order to adhere to this standard.

Test Plan: tested manually

Reviewers: spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3696
This commit is contained in:
Halla Moore 2017-01-15 16:28:44 -08:00
parent 79a8aa9319
commit 3e193be099
2 changed files with 5 additions and 3 deletions

View file

@ -70,7 +70,7 @@ class SendmailClient {
msgData.attachments.push({
filename: upload.filename,
content: fs.createReadStream(upload.targetPath),
cid: upload.id,
cid: upload.inline ? upload.id : null,
})
}

View file

@ -188,7 +188,8 @@ class MessageProcessor {
// end of the sync loop?)
const files = await extractFiles({db, messageValues, struct});
if (files.length > 0 && !thread.hasAttachments) {
// Don't count inline images (files with contentIds) as attachments
if (files.some(f => !f.contentId) && !thread.hasAttachments) {
thread.hasAttachments = true;
await thread.save();
}
@ -228,7 +229,8 @@ class MessageProcessor {
}
await this._addReferences(db, existingMessage, thread, parsedMessage.references);
const files = await extractFiles({db, messageValues: existingMessage, struct});
if (files.length > 0 && !thread.hasAttachments) {
// Don't count inline images (files with contentIds) as attachments
if (files.some(f => !f.contentId) && !thread.hasAttachments) {
thread.hasAttachments = true;
await thread.save();
}