From 0c6d279e82ac759f96621fe4db1df1f665757b91 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 21 Nov 2013 17:44:03 +0100 Subject: [PATCH] Show error msg in message list --- src/js/app-config.js | 4 ++-- src/js/dao/email-dao.js | 14 ++++++++------ test/new-unit/email-dao-test.js | 5 +++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/js/app-config.js b/src/js/app-config.js index 5d6ff9c..a7646c4 100644 --- a/src/js/app-config.js +++ b/src/js/app-config.js @@ -47,8 +47,8 @@ define(function(require) { app.string = { subjectPrefix: '[whiteout] ', invitationSubject: 'Invitation to a private conversation', - invitationMessage: 'I would like to invite you to a private conversation. To read my encrypted messages, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg', - message: 'this is a private conversation. To read my encrypted message below, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg', + invitationMessage: 'I would like to invite you to a private conversation. To read my encrypted messages, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them.\n\nOpen Whiteout Mail: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg', + message: 'this is a private conversation. To read my encrypted message below, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them.\n\nOpen Whiteout Mail: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg', cryptPrefix: '-----BEGIN PGP MESSAGE-----', cryptSuffix: '-----END PGP MESSAGE-----', signature: 'Sent securely from whiteout mail', diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index 86acbff..d29de52 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -295,9 +295,7 @@ define(function(require) { if (!senderPubkey) { // this should only happen if a mail from another channel is in the inbox - callback({ - errMsg: 'No public key for the sender' - }); + setBodyAndContinue('Public key for sender not found!'); return; } @@ -307,11 +305,15 @@ define(function(require) { decrypted = err.errMsg; } - email.body = decrypted; - cleartextList.push(email); - localCallback(); + setBodyAndContinue(decrypted); }); }); + + function setBodyAndContinue(text) { + email.body = text; + cleartextList.push(email); + localCallback(); + } } function verify(email, localCallback) { diff --git a/test/new-unit/email-dao-test.js b/test/new-unit/email-dao-test.js index 7251563..c3d1407 100644 --- a/test/new-unit/email-dao-test.js +++ b/test/new-unit/email-dao-test.js @@ -608,8 +608,9 @@ define(function(require) { offset: 0, num: 1 }, function(err, emails) { - expect(err).to.exist; - expect(emails).to.not.exist; + expect(err).to.not.exist; + expect(emails).to.exist; + expect(emails[0].body).to.equal('Public key for sender not found!'); expect(devicestorageStub.listItems.calledOnce).to.be.true; expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true; done();