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

Merge pull request #23 from whiteout-io/dev/remove-angular-property

remove angular properties from mail dto
This commit is contained in:
Tankred Hase 2014-02-24 18:30:35 +01:00
commit 4ed680e9c0
2 changed files with 27 additions and 23 deletions

View File

@ -811,16 +811,30 @@ define(function(require) {
message.loadingBody = false;
self._localStoreMessages({
// do not write the object from the object used by angular to the disk, instead
// do a short round trip and write back the unpolluted object
self._localListMessages({
folder: folder,
emails: [message]
}, function(error) {
uid: message.uid
}, function(error, storedMessages) {
if (error) {
callback(error);
return;
}
handleEncryptedContent();
storedMessages[0].body = message.body;
self._localStoreMessages({
folder: folder,
emails: storedMessages
}, function(error) {
if (error) {
callback(error);
return;
}
handleEncryptedContent();
});
});
});
}

View File

@ -994,7 +994,6 @@ define(function(require) {
body: body
}]);
dao.getBody({
message: message,
folder: folder
@ -1027,7 +1026,7 @@ define(function(require) {
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
folder: folder,
uid: uid
}).yieldsAsync(null, [{}]);
}).yieldsAsync(null, [message]);
localStoreStub = sinon.stub(dao, '_localStoreMessages').withArgs({
folder: folder,
@ -1056,7 +1055,7 @@ define(function(require) {
expect(msg.encrypted).to.be.false;
expect(msg.loadingBody).to.be.false;
expect(localListStub.calledOnce).to.be.true;
expect(localListStub.calledTwice).to.be.true;
expect(imapStreamStub.calledOnce).to.be.true;
expect(localStoreStub.calledOnce).to.be.true;
@ -1078,7 +1077,7 @@ define(function(require) {
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
folder: folder,
uid: uid
}).yieldsAsync(null, [{}]);
}).yieldsAsync(null, [message]);
localStoreStub = sinon.stub(dao, '_localStoreMessages').withArgs({
folder: folder,
@ -1108,7 +1107,7 @@ define(function(require) {
expect(msg.decrypted).to.be.false;
expect(msg.loadingBody).to.be.false;
expect(localListStub.calledOnce).to.be.true;
expect(localListStub.calledTwice).to.be.true;
expect(imapStreamStub.calledOnce).to.be.true;
expect(localStoreStub.calledOnce).to.be.true;
@ -1121,33 +1120,27 @@ define(function(require) {
var message, uid, folder, body, localListStub, localStoreStub, imapStreamStub;
folder = 'asdasdasdasdasd';
body = 'THIS IS THE BODY';
uid = 1234;
message = {
uid: uid
};
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
folder: folder,
uid: uid
}).yields(null, [{}]);
localListStub = sinon.stub(dao, '_localListMessages').yieldsAsync(null, [message]);
localStoreStub = sinon.stub(dao, '_localStoreMessages').yieldsAsync({});
imapStreamStub = sinon.stub(dao, '_imapStreamText', function(opts, cb) {
message.body = body;
cb();
});
localStoreStub = sinon.stub(dao, '_localStoreMessages').withArgs({
folder: folder,
emails: [message]
}).yields({});
dao.getBody({
message: message,
folder: folder
}, function(err, msg) {
expect(err).to.exist;
expect(msg).to.not.exist;
expect(localListStub.calledOnce).to.be.true;
expect(localListStub.calledTwice).to.be.true;
expect(imapStreamStub.calledOnce).to.be.true;
expect(localStoreStub.calledOnce).to.be.true;
@ -1166,10 +1159,7 @@ define(function(require) {
uid: uid
};
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
folder: folder,
uid: uid
}).yields(null, [{}]);
localListStub = sinon.stub(dao, '_localListMessages').yields(null, [{}]);
imapStreamStub = sinon.stub(dao, '_imapStreamText', function(opts, cb) {
message.body = body;