mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-10 14:44:52 +08:00
[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:
parent
79a8aa9319
commit
3e193be099
2 changed files with 5 additions and 3 deletions
|
@ -70,7 +70,7 @@ class SendmailClient {
|
||||||
msgData.attachments.push({
|
msgData.attachments.push({
|
||||||
filename: upload.filename,
|
filename: upload.filename,
|
||||||
content: fs.createReadStream(upload.targetPath),
|
content: fs.createReadStream(upload.targetPath),
|
||||||
cid: upload.id,
|
cid: upload.inline ? upload.id : null,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,8 @@ class MessageProcessor {
|
||||||
// end of the sync loop?)
|
// end of the sync loop?)
|
||||||
|
|
||||||
const files = await extractFiles({db, messageValues, struct});
|
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;
|
thread.hasAttachments = true;
|
||||||
await thread.save();
|
await thread.save();
|
||||||
}
|
}
|
||||||
|
@ -228,7 +229,8 @@ class MessageProcessor {
|
||||||
}
|
}
|
||||||
await this._addReferences(db, existingMessage, thread, parsedMessage.references);
|
await this._addReferences(db, existingMessage, thread, parsedMessage.references);
|
||||||
const files = await extractFiles({db, messageValues: existingMessage, struct});
|
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;
|
thread.hasAttachments = true;
|
||||||
await thread.save();
|
await thread.save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue