[FIX] mass_mailing: fix incorrect mark up in chatter

Markup usage has been enforced in the mail module since [1].

In mass mailing, a `Markup` array is joined usin the  string
method thus the resul is not marked up which leads to html
structure being printed to the dom.

This PR fixes this issue.

[1] https://github.com/odoo/odoo/pull/111850

closes odoo/odoo#123705

X-original-commit: 59f4cf98aadd6b740cbb1d9c92188ea1d708648f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
This commit is contained in:
tsm-odoo
2023-06-05 16:17:12 +02:00
parent fc213e5c66
commit 65c8ea060a
@@ -54,14 +54,15 @@ class MassSMSTest(models.TransientModel):
_('Test SMS successfully sent to %s', sent_sms.get('res_id')))
elif sent_sms.get('state'):
notification_messages.append(
_('Test SMS could not be sent to %s:<br>%s',
_('Test SMS could not be sent to %s: %s',
sent_sms.get('res_id'),
error_messages.get(sent_sms['state'], _("An error occurred.")))
)
if notification_messages:
self.mailing_id._message_log(body=Markup('<ul>%s</ul>') % ''.join(
[Markup('<li>%s</li>') % notification_message for notification_message in notification_messages]
))
message_body = Markup(
f"<ul>{''.join('<li>%s</li>' for _ in notification_messages)}</ul>"
) % tuple(notification_messages)
self.mailing_id._message_log(body=message_body)
return True