[local-sync] Still download messages when they have no body

There are plenty of valid use cases for sending subject-only emails,
and we also want to still download the headers and create message
objects if e.g. the email consists of only an event invitation or
an attachment.
This commit is contained in:
Christine Spang 2017-01-11 18:06:11 -08:00
parent 3eb450e22c
commit d36ae8db3c

View file

@ -204,7 +204,7 @@ class FetchMessagesInFolder extends SyncOperation {
// attachment metadata is extracted later---ignore for now
}
if (desired.length === 0) {
if (desired.length === 0 && available.length !== 0) {
this._logger.warn({
available_options: available.join(', '),
}, `FetchMessagesInFolder: Could not find good part`)
@ -220,9 +220,6 @@ class FetchMessagesInFolder extends SyncOperation {
yield this._box.fetchEach(rangeQuery, {struct: true}, ({attributes}) => {
const desiredParts = this._getDesiredMIMEParts(attributes.struct);
if (desiredParts.length === 0) {
return;
}
const key = JSON.stringify(desiredParts);
uidsByPart[key] = uidsByPart[key] || [];
uidsByPart[key].push(attributes.uid);