diff --git a/src/js/controller/mail-list.js b/src/js/controller/mail-list.js index 7704bdc..7ae66ee 100644 --- a/src/js/controller/mail-list.js +++ b/src/js/controller/mail-list.js @@ -59,6 +59,11 @@ define(function(require) { // $scope.getContent = function(email) { + // don't stream message content of outbox messages... + if (getFolder().type === 'Outbox') { + return; + } + emailDao.getMessageContent({ folder: getFolder().path, message: email @@ -72,17 +77,21 @@ define(function(require) { * Called when clicking on an email list item */ $scope.select = function(email) { + // unselect an item if (!email) { $scope.state.mailList.selected = undefined; return; } - emailDao.decryptMessageContent({ - message: email - }, function(error) { - $scope.$apply(); - $scope.onError(error); - }); + // if we're in the outbox, don't decrypt as usual + if (getFolder().type !== 'Outbox') { + emailDao.decryptMessageContent({ + message: email + }, function(error) { + $scope.$apply(); + $scope.onError(error); + }); + } $scope.state.mailList.selected = email; $scope.state.read.toggle(true); diff --git a/test/new-unit/mail-list-ctrl-test.js b/test/new-unit/mail-list-ctrl-test.js index 0d96be7..093f72e 100644 --- a/test/new-unit/mail-list-ctrl-test.js +++ b/test/new-unit/mail-list-ctrl-test.js @@ -249,7 +249,7 @@ define(function(require) { scope.state = { nav: { currentFolder: { - type: 'asd', + type: 'asd' } }, mailList: {}, @@ -278,6 +278,11 @@ define(function(require) { mailList: {}, read: { toggle: function() {} + }, + nav: { + currentFolder: { + type: 'asd' + } } };