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 c13aa9dcda2..f09476e1a5a 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 @@ -140,4 +140,25 @@ publicWidget.registry.subscribe = publicWidget.Widget.extend({ }); }, }); + +/** + * This widget tries to fix snippets that were malformed because of a missing + * upgrade script. Without this, some newsletter snippets coming from users + * upgraded from a version lower than 16.0 may not be able to update their + * newsletter block. + * + * TODO an upgrade script should be made to fix databases and get rid of this. + */ +publicWidget.registry.fixNewsletterListClass = publicWidget.Widget.extend({ + selector: '.s_newsletter_subscribe_form:not(.s_subscription_list), .s_newsletter_block', + + /** + * @override + */ + start() { + this.$target[0].classList.add('s_newsletter_list'); + return this._super(...arguments); + }, +}); + }); diff --git a/addons/website_mass_mailing/views/snippets_templates.xml b/addons/website_mass_mailing/views/snippets_templates.xml index 14552219114..4949f08708f 100644 --- a/addons/website_mass_mailing/views/snippets_templates.xml +++ b/addons/website_mass_mailing/views/snippets_templates.xml @@ -23,6 +23,10 @@ + +