From ced062db12f4b78b62e9991a32142a482b64fbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=2E=20D=C3=ADaz?= Date: Mon, 1 Feb 2021 18:38:54 +0100 Subject: [PATCH] [IMP] mail_tracking: Discuss failed messages: Only show confirmation if needed --- .../static/src/js/failed_message/discuss.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mail_tracking/static/src/js/failed_message/discuss.js b/mail_tracking/static/src/js/failed_message/discuss.js index 2fb8edd..01cade6 100644 --- a/mail_tracking/static/src/js/failed_message/discuss.js +++ b/mail_tracking/static/src/js/failed_message/discuss.js @@ -341,18 +341,21 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) { _onSetAllAsReviewedClicked: function() { var self = this; var failed = this.call("mail_service", "getMailbox", "failed"); - var promptText = _.str.sprintf( - _t( - "Do you really want to mark as reviewed all the" + - " failed messages (%d)?" - ), - failed.getMailboxCounter() - ); - Dialog.confirm(this, promptText, { - confirm_callback: function() { - self._thread.setAllMessagesAsReviewed(); - }, - }); + var failed_counter = failed.getMailboxCounter(); + if (failed_counter > 0) { + var promptText = _.str.sprintf( + _t( + "Do you really want to mark as reviewed all the" + + " failed messages (%d)?" + ), + failed_counter + ); + Dialog.confirm(this, promptText, { + confirm_callback: function() { + self._thread.setAllMessagesAsReviewed(); + }, + }); + } }, });