mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 02:42:17 -05:00
[WO-112] Mark replied to emails as answered
This commit is contained in:
parent
d779ef679d
commit
d544b2cf3d
@ -23,6 +23,10 @@ define(function(require) {
|
||||
//
|
||||
|
||||
$scope.$root.onError = function(options) {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.error(options);
|
||||
$scope.state.dialog = {
|
||||
open: true,
|
||||
|
@ -24,12 +24,14 @@ define(function(require) {
|
||||
open: false,
|
||||
write: function(replyTo) {
|
||||
this.open = true;
|
||||
$scope.replyTo = replyTo;
|
||||
|
||||
resetFields();
|
||||
if (replyTo) {
|
||||
|
||||
// fill fields depending on replyTo
|
||||
fillFields(replyTo);
|
||||
$scope.updatePreview();
|
||||
}
|
||||
|
||||
$scope.verifyTo();
|
||||
},
|
||||
close: function() {
|
||||
@ -86,7 +88,7 @@ define(function(require) {
|
||||
// check if to address is contained in known public keys
|
||||
emailDao._keychain.getReceiverPublicKey($scope.to, function(err, key) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
$scope.onError(err);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -174,15 +176,29 @@ define(function(require) {
|
||||
email.id = util.UUID();
|
||||
emailDao._devicestorage.storeList([email], 'email_OUTBOX', function(err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
$scope.onError(err);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.state.writer.close();
|
||||
$scope.$apply();
|
||||
$scope.emptyOutbox();
|
||||
|
||||
markAnwsered();
|
||||
});
|
||||
};
|
||||
|
||||
function markAnwsered() {
|
||||
// mark replyTo as answered
|
||||
if (!$scope.replyTo) {
|
||||
return;
|
||||
}
|
||||
|
||||
emailDao.imapMarkAnswered({
|
||||
uid: $scope.replyTo.uid,
|
||||
folder: $scope.state.nav.currentFolder.path
|
||||
}, $scope.onError);
|
||||
}
|
||||
};
|
||||
|
||||
function parseBody(body) {
|
||||
|
@ -516,6 +516,16 @@ define(function(require) {
|
||||
}, callback);
|
||||
};
|
||||
|
||||
EmailDAO.prototype.imapMarkAnswered = function(options, callback) {
|
||||
var self = this;
|
||||
|
||||
self._imapClient.updateFlags({
|
||||
path: options.folder,
|
||||
uid: options.uid,
|
||||
answered: true
|
||||
}, callback);
|
||||
};
|
||||
|
||||
//
|
||||
// SMTP Apis
|
||||
//
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="list-wrapper" ng-iscroll="emails">
|
||||
<ul class="mail-list">
|
||||
<li ng-class="{'mail-list-active': email === state.mailList.selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread, 'mail-list-replied': email.answered}" ng-click="select(email)" ng-repeat="email in emails">
|
||||
<li ng-class="{'mail-list-active': email === state.mailList.selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread && !email.answered, 'mail-list-replied': email.answered}" ng-click="select(email)" ng-repeat="email in emails">
|
||||
<h3>{{email.from[0].name || email.from[0].address}}</h3>
|
||||
<div class="head">
|
||||
<p class="subject">{{email.subject || 'No subject'}}</p>
|
||||
|
@ -750,6 +750,21 @@ define(function(require) {
|
||||
});
|
||||
});
|
||||
|
||||
describe('IMAP: mark message as answered', function() {
|
||||
it('should work', function(done) {
|
||||
imapClientStub.updateFlags.yields();
|
||||
|
||||
emailDao.imapMarkAnswered({
|
||||
folder: 'asdf',
|
||||
uid: 1
|
||||
}, function(err) {
|
||||
expect(imapClientStub.updateFlags.calledOnce).to.be.true;
|
||||
expect(err).to.not.exist;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user