mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 10:30:18 -05:00
sync answered flag after sending
This commit is contained in:
parent
b4115ed879
commit
f721b06bb4
@ -169,11 +169,11 @@ define(function(require) {
|
|||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
$scope.emptyOutbox($scope.onOutboxUpdate);
|
$scope.emptyOutbox($scope.onOutboxUpdate);
|
||||||
|
|
||||||
markAnwsered();
|
markAnswered();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function markAnwsered() {
|
function markAnswered() {
|
||||||
// mark replyTo as answered
|
// mark replyTo as answered
|
||||||
if (!$scope.replyTo) {
|
if (!$scope.replyTo) {
|
||||||
return;
|
return;
|
||||||
@ -181,6 +181,9 @@ define(function(require) {
|
|||||||
|
|
||||||
// mark list object
|
// mark list object
|
||||||
$scope.replyTo.answered = true;
|
$scope.replyTo.answered = true;
|
||||||
|
emailDao.sync({
|
||||||
|
folder: $scope.state.nav.currentFolder.path
|
||||||
|
}, $scope.onError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('send to outbox', function() {
|
describe('send to outbox', function() {
|
||||||
it('should work', function() {
|
it('should work', function(done) {
|
||||||
var verifyToSpy = sinon.spy(scope, 'verifyTo'),
|
var verifyToSpy = sinon.spy(scope, 'verifyTo'),
|
||||||
re = {
|
re = {
|
||||||
from: [{
|
from: [{
|
||||||
@ -157,17 +157,23 @@ define(function(require) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.emptyOutbox = function() {};
|
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.store.yields();
|
||||||
|
emailDaoMock.sync.yields();
|
||||||
|
|
||||||
scope.state.writer.write(re);
|
scope.state.writer.write(re);
|
||||||
scope.sendToOutbox();
|
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) {
|
it('should not work and not close the write view', function(done) {
|
||||||
|
Loading…
Reference in New Issue
Block a user