1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 12:22:22 -05:00

fix bug when uid smaller than max uid in memory exists on imap

This commit is contained in:
Felix Hammerl 2014-02-20 11:34:55 +01:00
parent 8973c3e2b3
commit 6a8bb527fc
2 changed files with 7 additions and 7 deletions

View File

@ -437,12 +437,6 @@ define(function(require) {
var inMemoryUids = _.pluck(folder.messages, 'uid'), var inMemoryUids = _.pluck(folder.messages, 'uid'),
delta4 = _.difference(inImapUids, inMemoryUids); delta4 = _.difference(inImapUids, inMemoryUids);
// no delta, we're done here
if (_.isEmpty(delta4)) {
doDeltaF4();
return;
}
// eliminate uids smaller than the biggest local uid, i.e. just fetch everything // eliminate uids smaller than the biggest local uid, i.e. just fetch everything
// that came in AFTER the most recent email we have in memory. Keep in mind that // that came in AFTER the most recent email we have in memory. Keep in mind that
// uids are strictly ascending, so there can't be a NEW mail in the mailbox with a // uids are strictly ascending, so there can't be a NEW mail in the mailbox with a
@ -456,6 +450,12 @@ define(function(require) {
}); });
} }
// no delta, we're done here
if (_.isEmpty(delta4)) {
doDeltaF4();
return;
}
self._imapListMessages({ self._imapListMessages({
folder: folder.path, folder: folder.path,
firstUid: Math.min.apply(null, delta4), firstUid: Math.min.apply(null, delta4),

View File

@ -1476,7 +1476,7 @@ define(function(require) {
imapSearchStub = sinon.stub(dao, '_imapSearch'); imapSearchStub = sinon.stub(dao, '_imapSearch');
imapSearchStub.withArgs({ imapSearchStub.withArgs({
folder: folder folder: folder
}).yields(null, [dummyEncryptedMail.uid]); }).yields(null, [dummyEncryptedMail.uid - 10, dummyEncryptedMail.uid]);
imapSearchStub.withArgs({ imapSearchStub.withArgs({
folder: folder, folder: folder,
unread: true unread: true