(js) Show the reply-all btn in more situations

pull/249/head
Francis Lachapelle 2019-02-26 14:39:25 -05:00
parent aa6c0e553e
commit 66e1b348e0
2 changed files with 15 additions and 4 deletions

1
NEWS
View File

@ -3,6 +3,7 @@
Bug fixes
- [web] date validator now handles non-latin characters
- [web] show the "reply all" button in more situations
4.0.6 (2019-02-21)
------------------

View File

@ -274,12 +274,22 @@
* @returns true if the message is not a draft and has more than one recipient
*/
Message.prototype.allowReplyAll = function() {
var identities = _.map(this.$mailbox.$account.identities, 'email');
var recipientsCount = 0;
recipientsCount = _.reduce(['to', 'cc', 'bcc'], _.bind(function(count, type) {
if (this[type])
return count + this[type].length;
else
recipientsCount = _.reduce(['to', 'cc', 'bcc', 'reply-to'], _.bind(function(count, type) {
var typeCount = 0;
if (this[type]) {
typeCount = this[type].length;
_.forEach(this[type], function(recipient) {
if (_.indexOf(identities, recipient.email) >= 0) {
typeCount--;
}
});
return count + typeCount;
}
else {
return count;
}
}, this), recipientsCount);
return !this.isDraft && recipientsCount > 1;