From 1e8a7cc89ef60bb4367e9263603521ad855e444a Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Tue, 4 Jul 2023 13:23:21 +0000 Subject: [PATCH] [FIX] im_livechat: remove useless breaklines in rating MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the display of the rating message for the livechat sessions. Before, break lines were incorrectly inserted before and after the reason. closes odoo/odoo#127267 Signed-off-by: Sébastien Theys (seb) --- addons/im_livechat/controllers/main.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index 6ff9d5d3b18..cc70438ebb3 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -169,20 +169,17 @@ class LivechatController(http.Controller): ) def _post_feedback_message(self, channel, rating, reason): + reason = Markup("
" + re.sub(r'\r\n|\r|\n', "
", reason) if reason else "") body = Markup('''
- %(rating)s: rating
%(reason)s + %(rating)s: rating%(reason)s
''') % { 'rating': _('Rating'), 'rating_url': rating.rating_image_url, 'reason': reason, } - channel.message_post( - body=Markup(re.sub(r'\r\n|\r|\n', '
', body)), - message_type='notification', - subtype_xmlid='mail.mt_comment' - ) + channel.message_post(body=body, message_type='notification', subtype_xmlid='mail.mt_comment') @http.route('/im_livechat/feedback', type='json', auth='public', cors="*") def feedback(self, uuid, rate, reason=None, **kwargs):