[FIX] im_livechat: apply message update in real time

Since [1], the `mail.record/insert` notification is not
sent to the livechat visitor.

Since [2], this notification is not listened by the
notification handler either.

This PR fixes those issues in order to make message update
instantaneous on the public livechat.

1: https://github.com/odoo/odoo/pull/120018
2: https://github.com/odoo/odoo/pull/120893

task-3349454

closes odoo/odoo#123728

X-original-commit: 6f456e3b591ebc86502e4be65768042cc223c3db
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Debondt Didier (did) <did@odoo.com>
This commit is contained in:
tsm-odoo
2023-06-06 10:30:05 +02:00
parent a3da3ec98a
commit fc82e4feda
+2 -3
View File
@@ -101,8 +101,8 @@ class DiscussChannel(models.Model):
message_body = '<ul>%s</ul>' % (''.join(html_links))
self._send_transient_message(self.env['res.partner'].browse(pid), message_body)
def _message_update_content_after_hook(self, message):
self.ensure_one()
def _message_update_content(self, message, body, attachment_ids=None, strict=True, **kwargs):
super()._message_update_content(message=message, body=body, attachment_ids=attachment_ids, strict=strict, **kwargs)
if self.channel_type == 'livechat':
self.env['bus.bus']._sendone(self.uuid, 'mail.record/insert', {
'Message': {
@@ -110,7 +110,6 @@ class DiscussChannel(models.Model):
'body': message.body,
}
})
return super()._message_update_content_after_hook(message=message)
def _get_visitor_leave_message(self, operator=False, cancel=False):
return _('Visitor has left the conversation.')