[FIX] mail: prevent crash when deleting a message
Since https://github.com/odoo/odoo/pull/126713, deleting a message would crash as the `mail/message/update_content` route is called without passing the `partner_ids` parameter. This commit fixes the issue by making the parameter optional. closes odoo/odoo#127284 X-original-commit: 34abd3dc1d159962a376b248134d0cd4977f3dcb Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -109,8 +109,10 @@ 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(self, message, body, attachment_ids=None, strict=True, **kwargs):
|
||||
super()._message_update_content(message=message, body=body, attachment_ids=attachment_ids, strict=strict, **kwargs)
|
||||
def _message_update_content(self, message, body, attachment_ids=None, partner_ids=None, strict=True, **kwargs):
|
||||
super()._message_update_content(
|
||||
message=message, body=body, attachment_ids=attachment_ids, partner_ids=partner_ids, strict=strict, **kwargs
|
||||
)
|
||||
if self.channel_type == 'livechat':
|
||||
self.env['bus.bus']._sendone(self.uuid, 'mail.record/insert', {
|
||||
'Message': {
|
||||
|
||||
@@ -83,7 +83,7 @@ class ThreadController(http.Controller):
|
||||
return message_data
|
||||
|
||||
@http.route("/mail/message/update_content", methods=["POST"], type="json", auth="public")
|
||||
def mail_message_update_content(self, message_id, body, attachment_ids, partner_ids):
|
||||
def mail_message_update_content(self, message_id, body, attachment_ids, partner_ids=None):
|
||||
guest = request.env["mail.guest"]._get_guest_from_request(request)
|
||||
message_sudo = guest.env["mail.message"].browse(message_id).sudo().exists()
|
||||
if not message_sudo.is_current_user_or_guest_author and not guest.env.user._is_admin():
|
||||
|
||||
Reference in New Issue
Block a user