[IMP] mail_tracking: Discuss failed messages: Only show confirmation if needed

This commit is contained in:
Alexandre D. Díaz 2021-02-01 18:38:54 +01:00 committed by Jasmin Solanki
parent 6b55471fc3
commit ced062db12

View File

@ -341,18 +341,21 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
_onSetAllAsReviewedClicked: function() { _onSetAllAsReviewedClicked: function() {
var self = this; var self = this;
var failed = this.call("mail_service", "getMailbox", "failed"); var failed = this.call("mail_service", "getMailbox", "failed");
var promptText = _.str.sprintf( var failed_counter = failed.getMailboxCounter();
_t( if (failed_counter > 0) {
"Do you really want to mark as reviewed all the" + var promptText = _.str.sprintf(
" failed messages (%d)?" _t(
), "Do you really want to mark as reviewed all the" +
failed.getMailboxCounter() " failed messages (%d)?"
); ),
Dialog.confirm(this, promptText, { failed_counter
confirm_callback: function() { );
self._thread.setAllMessagesAsReviewed(); Dialog.confirm(this, promptText, {
}, confirm_callback: function() {
}); self._thread.setAllMessagesAsReviewed();
},
});
}
}, },
}); });