[FIX] website_mass_mailing: close popup after successful subscription

closes odoo/odoo#59153

X-original-commit: 548e45b9b7eea6c395c0e6959bec5b6418239ced
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Kishan Gajjar
2020-10-05 17:00:59 +00:00
committed by qsm-odoo
parent 2e767ffefa
commit 17dbdb62fe
@@ -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,
});