From 17dbdb62fe0a094ae8cd07c5c7cc44f37e371cfb Mon Sep 17 00:00:00 2001 From: Kishan Gajjar Date: Mon, 5 Oct 2020 15:32:41 +0000 Subject: [PATCH] [FIX] website_mass_mailing: close popup after successful subscription closes odoo/odoo#59153 X-original-commit: 548e45b9b7eea6c395c0e6959bec5b6418239ced Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/website_mass_mailing.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/website_mass_mailing/static/src/js/website_mass_mailing.js b/addons/website_mass_mailing/static/src/js/website_mass_mailing.js index 7a5a4f6c037..7847e075246 100644 --- a/addons/website_mass_mailing/static/src/js/website_mass_mailing.js +++ b/addons/website_mass_mailing/static/src/js/website_mass_mailing.js @@ -97,7 +97,8 @@ publicWidget.registry.subscribe = publicWidget.Widget.extend({ recaptcha_token_response: tokenObj.token, }, }).then(function (result) { - if (result.type === 'success') { + let toastType = result.toast_type; + if (toastType === 'success') { self.$(".js_subscribe_btn").addClass('d-none'); self.$(".js_subscribed_btn").removeClass('d-none'); self.$('input.js_subscribe_email').prop('disabled', !!result); @@ -106,8 +107,8 @@ publicWidget.registry.subscribe = publicWidget.Widget.extend({ } } self.displayNotification({ - type: result.toast_type, - title: _t(`${result.toast_type === 'success' ? 'Success' : 'Error'}`), + type: toastType, + title: _t(`${toastType === 'success' ? 'Success' : 'Error'}`), message: result.toast_content, sticky: true, });