From e050c9854bdbd056043302755b9677b106bc21be Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Fri, 4 Oct 2013 17:21:09 +0200 Subject: [PATCH] integrate bugfix for syncing emails from imap --- src/js/dao/email-dao.js | 5 ++--- test/new-unit/email-dao-test.js | 18 +++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index a92b348..d48e3f6 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -377,10 +377,9 @@ define(function(require) { callback(null, gottenMessage); } - self._imapClient.getMessage({ + self._imapClient.getMessagePreview({ path: options.folder, - uid: options.uid, - textOnly: true + uid: options.uid }, messageReady); }; diff --git a/test/new-unit/email-dao-test.js b/test/new-unit/email-dao-test.js index 0aa4213..18cbd3c 100644 --- a/test/new-unit/email-dao-test.js +++ b/test/new-unit/email-dao-test.js @@ -262,12 +262,12 @@ define(function(require) { }); }); - describe('IMAP: get message content', function() { + describe('IMAP: get message preview', function() { it('should fail due to bad options', function(done) { emailDao.imapGetMessage({ folder: 'INBOX' }, function(err) { - expect(imapClientStub.getMessage.called).to.be.false; + expect(imapClientStub.getMessagePreview.called).to.be.false; expect(err).to.exist; done(); }); @@ -276,7 +276,7 @@ define(function(require) { it('should parse message body without attachement', function(done) { var uid = 415; - imapClientStub.getMessage.yields(null, { + imapClientStub.getMessagePreview.yields(null, { uid: uid, body: '' }); @@ -284,7 +284,7 @@ define(function(require) { folder: 'INBOX', uid: uid }, function(err, message) { - expect(imapClientStub.getMessage.calledOnce).to.be.true; + expect(imapClientStub.getMessagePreview.calledOnce).to.be.true; expect(err).to.not.exist; expect(message.uid).to.equal(uid); expect(message.attachments).to.not.exist; @@ -313,7 +313,7 @@ define(function(require) { // folder: 'INBOX', // uid: uid // }, function(err, message) { - // expect(newImapClientStub.getMessage.calledOnce).to.be.true; + // expect(newImapClientStub.getMessagePreview.calledOnce).to.be.true; // expect(err).to.not.exist; // expect(message.uid).to.equal(uid); // expect(message.attachments[0].uint8Array).to.exist; @@ -330,7 +330,7 @@ define(function(require) { }, { uid: 414, }]); - imapClientStub.getMessage.yields(null, { + imapClientStub.getMessagePreview.yields(null, { body: 'asdf' }); devicestorageStub.removeList.yields(); @@ -343,7 +343,7 @@ define(function(require) { }, function(err) { expect(err).to.not.exist; expect(imapClientStub.listMessages.calledOnce).to.be.true; - expect(imapClientStub.getMessage.called).to.be.false; + expect(imapClientStub.getMessagePreview.called).to.be.false; expect(devicestorageStub.removeList.calledOnce).to.be.true; expect(devicestorageStub.storeList.calledOnce).to.be.true; done(); @@ -358,7 +358,7 @@ define(function(require) { uid: 414, subject: app.string.subject }]); - imapClientStub.getMessage.yields(null, { + imapClientStub.getMessagePreview.yields(null, { body: 'asdf' }); devicestorageStub.removeList.yields(); @@ -371,7 +371,7 @@ define(function(require) { }, function(err) { expect(err).to.not.exist; expect(imapClientStub.listMessages.calledOnce).to.be.true; - expect(imapClientStub.getMessage.calledTwice).to.be.true; + expect(imapClientStub.getMessagePreview.calledTwice).to.be.true; expect(devicestorageStub.removeList.calledOnce).to.be.true; expect(devicestorageStub.storeList.calledOnce).to.be.true; done();