mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
[local-sync] Fix isDraft check (check array exists)
Summary: see title Test Plan: manual Reviewers: spang Reviewed By: spang Differential Revision: https://phab.nylas.com/D3781
This commit is contained in:
parent
b33c55443b
commit
c097a86169
1 changed files with 8 additions and 3 deletions
|
@ -261,8 +261,13 @@ async function parseFromImap(imapMessage, desiredParts, {db, accountId, folder})
|
|||
// because we want to exclude drafts moved to the trash from the drafts view
|
||||
// see https://github.com/nylas/cloud-core/commit/1433921a166ddcba7c269158d65febb7928767d8
|
||||
// & associated phabricator bug https://phab.nylas.com/T5696
|
||||
isDraft: (attributes.flags.includes('\\Draft') || parsedHeaders['x-gm-labels'].includes('\\Draft'))
|
||||
&& ['drafts', 'all'].includes(folder.role),
|
||||
isDraft: (
|
||||
['drafts', 'all'].includes(folder.role) &&
|
||||
(
|
||||
attributes.flags.includes('\\Draft') ||
|
||||
(parsedHeaders['x-gm-labels'] || []).includes('\\Draft')
|
||||
)
|
||||
),
|
||||
// We prefer the date from the message headers because the date is one of
|
||||
// the fields we use for generating unique message IDs, and the server
|
||||
// INTERNALDATE, `attributes.date`, may differ across accounts for the same
|
||||
|
@ -301,7 +306,7 @@ async function parseFromImap(imapMessage, desiredParts, {db, accountId, folder})
|
|||
|
||||
parsedMessage.folder = folder;
|
||||
|
||||
const xGmLabels = attributes['x-gm-labels']
|
||||
const xGmLabels = parsedHeaders['x-gm-labels']
|
||||
if (xGmLabels) {
|
||||
parsedMessage.folderImapXGMLabels = JSON.stringify(xGmLabels)
|
||||
parsedMessage.labels = await Label.findXGMLabels(xGmLabels)
|
||||
|
|
Loading…
Reference in a new issue