[FIX] mass_mailing: re-display sidebar in non-basic themed mailing

Steps to reproduce bug:

Loop through the form view of mailing records having at least one of
them the 'basic' theme, and the other ones any other theme.
Once a mailing has the 'basic' theme, the sidebar is hidden (expected
behaviour). But the sidebar will remain hidden for all mailing records,
even the ones based on different themes (that would normally display the
sidebar).

The cause:

There's a CSS rule to make 'display: none' when the iframe's body
has the 'o_basic_theme' class.
(see addons/mass_mailing/static/src/scss/mass_mailing.ui.scss)
And the theme class is not properly cleared when switching between records
of different themes.

This commit fixes the issue by properly removing any theme classes
before adding the current theme's one.

Part-of: odoo/odoo#117166
This commit is contained in:
Rodolpho Lima
2023-04-13 16:40:07 +02:00
parent 89a7d47914
commit a27fbf4aaf
@@ -406,6 +406,8 @@ export class MassMailingHtmlField extends HtmlField {
$target.parents('.o_mail_template_preview').remove();
});
// Clear any previous theme class before adding new one.
this.wysiwyg.$iframeBody.closest('body').removeClass(this._themeClassNames);
let selectedTheme = this._getSelectedTheme(themesParams);
if (selectedTheme) {
this.wysiwyg.$iframeBody.closest('body').addClass(selectedTheme.className);