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

Close read mode after replying to a message

This commit is contained in:
Tankred Hase 2014-12-05 17:02:19 +01:00
parent 6f794ff26d
commit e00f2ecb3d
2 changed files with 11 additions and 3 deletions

View File

@ -6,7 +6,7 @@ var util = require('crypto-lib').util;
// Controller
//
var WriteCtrl = function($scope, $filter, $q, appConfig, auth, keychain, pgp, email, outbox, dialog, axe) {
var WriteCtrl = function($scope, $window, $filter, $q, appConfig, auth, keychain, pgp, email, outbox, dialog, axe, status) {
var str = appConfig.string;
var cfg = appConfig.config;
@ -341,6 +341,10 @@ var WriteCtrl = function($scope, $filter, $q, appConfig, auth, keychain, pgp, em
// close the writer
$scope.state.writer.close();
// close read mode after reply
if ($scope.replyTo) {
status.setReading(false);
}
// persist the email to disk for later sending
outbox.put(message, function(err) {

View File

@ -6,11 +6,12 @@ var WriteCtrl = require('../../../../src/js/controller/app/write'),
Keychain = require('../../../../src/js/service/keychain'),
Auth = require('../../../../src/js/service/auth'),
PGP = require('../../../../src/js/crypto/pgp'),
Status = require('../../../../src/js/util/status'),
Dialog = require('../../../../src/js/util/dialog');
describe('Write controller unit test', function() {
var ctrl, scope,
authMock, pgpMock, dialogMock, emailMock, keychainMock, outboxMock,
authMock, pgpMock, dialogMock, emailMock, keychainMock, outboxMock, statusMock,
emailAddress, realname;
beforeEach(function() {
@ -21,6 +22,7 @@ describe('Write controller unit test', function() {
outboxMock = sinon.createStubInstance(Outbox);
emailMock = sinon.createStubInstance(Email);
keychainMock = sinon.createStubInstance(Keychain);
statusMock = sinon.createStubInstance(Status);
emailAddress = 'fred@foo.com';
realname = 'Fred Foo';
@ -39,7 +41,8 @@ describe('Write controller unit test', function() {
pgp: pgpMock,
email: emailMock,
outbox: outboxMock,
dialog: dialogMock
dialog: dialogMock,
status: statusMock
});
});
});
@ -343,6 +346,7 @@ describe('Write controller unit test', function() {
scope.sendToOutbox();
expect(statusMock.setReading.withArgs(false).calledOnce).to.be.true;
expect(outboxMock.put.calledOnce).to.be.true;
expect(emailMock.setFlags.calledOnce).to.be.true;
expect(scope.state.lightbox).to.be.undefined;