fix(fusion_helpdesk): reply body_is_html=True so HTML isn't escaped over XML-RPC

Remote message_post escapes a plain str body (expects Markup, which can't cross XML-RPC). Without body_is_html=True the customer's reply rendered literal <p>/<br> tags.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-27 03:41:04 -04:00
parent 9dceff5baf
commit 6ce49573ef

View File

@@ -598,9 +598,14 @@ class FusionHelpdeskController(http.Controller):
return {'ok': False, 'error': 'not_found', return {'ok': False, 'error': 'not_found',
'message': _('Ticket not found or not accessible.')} 'message': _('Ticket not found or not accessible.')}
author_id = self._resolve_author(cfg, ident, found[0]) author_id = self._resolve_author(cfg, ident, found[0])
# We escape the user's text ourselves, then mark it up as paragraphs.
# message_post() ESCAPES a plain str body (it expects a Markup for
# HTML) — but Markup can't cross XML-RPC, so we pass body_is_html=True
# which tells the remote message_post to treat our already-escaped
# HTML as Markup. Without this the customer would see literal <p> tags.
html = '<p>%s</p>' % _html_escape(text).replace('\n', '<br/>') html = '<p>%s</p>' % _html_escape(text).replace('\n', '<br/>')
self._rpc(cfg, 'helpdesk.ticket', 'message_post', [[ticket_id]], { self._rpc(cfg, 'helpdesk.ticket', 'message_post', [[ticket_id]], {
'body': html, 'message_type': 'comment', 'body': html, 'body_is_html': True, 'message_type': 'comment',
'subtype_xmlid': 'mail.mt_comment', 'author_id': author_id, 'subtype_xmlid': 'mail.mt_comment', 'author_id': author_id,
}) })
messages = self._public_messages(cfg, ticket_id) messages = self._public_messages(cfg, ticket_id)