mirror of
https://github.com/moparisthebest/mail
synced 2024-12-22 07:18:49 -05:00
[WO-855] Fix trying to set a flag when email is deleted
This commit is contained in:
parent
3da5a55251
commit
2e3e07aa1d
@ -492,6 +492,12 @@ Email.prototype.setFlags = function(options) {
|
|||||||
}).then(function(storedMessages) {
|
}).then(function(storedMessages) {
|
||||||
// set the flags
|
// set the flags
|
||||||
var storedMessage = storedMessages[0];
|
var storedMessage = storedMessages[0];
|
||||||
|
|
||||||
|
if (!storedMessage) {
|
||||||
|
// the message has been deleted in the meantime
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
storedMessage.unread = options.message.unread;
|
storedMessage.unread = options.message.unread;
|
||||||
storedMessage.flagged = options.message.flagged;
|
storedMessage.flagged = options.message.flagged;
|
||||||
storedMessage.answered = options.message.answered;
|
storedMessage.answered = options.message.answered;
|
||||||
|
@ -733,6 +733,32 @@ describe('Email DAO unit tests', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not explode when message has been deleted during imap roundtrip', function(done) {
|
||||||
|
imapMark.withArgs({
|
||||||
|
folder: inboxFolder,
|
||||||
|
uid: message.uid,
|
||||||
|
unread: message.unread,
|
||||||
|
answered: message.answered,
|
||||||
|
flagged: message.flagged
|
||||||
|
}).returns(resolves());
|
||||||
|
|
||||||
|
localListStub.withArgs({
|
||||||
|
folder: inboxFolder,
|
||||||
|
uid: message.uid
|
||||||
|
}).returns(resolves([]));
|
||||||
|
|
||||||
|
dao.setFlags({
|
||||||
|
folder: inboxFolder,
|
||||||
|
message: message
|
||||||
|
}).then(function() {
|
||||||
|
expect(imapMark.calledOnce).to.be.true;
|
||||||
|
expect(localListStub.calledOnce).to.be.true;
|
||||||
|
expect(localStoreStub.called).to.be.false;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should set flags for outbox for disk, memory', function(done) {
|
it('should set flags for outbox for disk, memory', function(done) {
|
||||||
localListStub.withArgs({
|
localListStub.withArgs({
|
||||||
folder: outboxFolder,
|
folder: outboxFolder,
|
||||||
|
Loading…
Reference in New Issue
Block a user