1
0
mirror of https://github.com/moparisthebest/mail synced 2025-02-07 02:20:14 -05:00

sync answered flag after sending

This commit is contained in:
Felix Hammerl 2013-12-05 18:50:03 +01:00
parent b4115ed879
commit f721b06bb4
2 changed files with 17 additions and 8 deletions

View File

@ -169,11 +169,11 @@ define(function(require) {
$scope.$apply();
$scope.emptyOutbox($scope.onOutboxUpdate);
markAnwsered();
markAnswered();
});
};
function markAnwsered() {
function markAnswered() {
// mark replyTo as answered
if (!$scope.replyTo) {
return;
@ -181,6 +181,9 @@ define(function(require) {
// mark list object
$scope.replyTo.answered = true;
emailDao.sync({
folder: $scope.state.nav.currentFolder.path
}, $scope.onError);
}
};

View File

@ -141,7 +141,7 @@ define(function(require) {
});
describe('send to outbox', function() {
it('should work', function() {
it('should work', function(done) {
var verifyToSpy = sinon.spy(scope, 'verifyTo'),
re = {
from: [{
@ -157,17 +157,23 @@ define(function(require) {
};
scope.emptyOutbox = function() {};
scope.onError = function(err) {
expect(err).to.not.exist;
expect(scope.state.writer.open).to.be.false;
expect(verifyToSpy.calledOnce).to.be.true;
expect(emailDaoMock.store.calledOnce).to.be.true;
expect(emailDaoMock.sync.calledOnce).to.be.true;
scope.verifyTo.restore();
done();
};
emailDaoMock.store.yields();
emailDaoMock.sync.yields();
scope.state.writer.write(re);
scope.sendToOutbox();
expect(scope.state.writer.open).to.be.false;
expect(emailDaoMock.store.calledOnce).to.be.true;
expect(verifyToSpy.calledOnce).to.be.true;
scope.verifyTo.restore();
});
it('should not work and not close the write view', function(done) {