From 3caac9399ba3c190a4111aebbed28c8cc5e4d7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 23 Jun 2022 09:21:46 +0000 Subject: [PATCH] [FIX] im_livechat: no unamed attachment on public livechat messages Follow-up of https://github.com/odoo/odoo/commit/0c30945d364a8b986f0b48db28e42c7b355471e3 Commit above changed the message formatter in python, so that `attachment_ids` now always return a list of field commands. This work fine in backend code of discuss, but in public livechat, it still uses legacy code. The legacy code do not support field commands, so instead it thinks the command is data of an attachment, thus showing an "unamed" attachment. Actually attachments are not supported in livechat. Code had some handling of attachments just because this was shared with the backend in the past. This commit fixes the issues by simply enforcing showing no attachment in any message in public livechat. closes odoo/odoo#94394 Signed-off-by: Louis Wicket (wil) --- .../im_livechat/static/src/legacy/models/abstract_message.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/legacy/models/abstract_message.js b/addons/im_livechat/static/src/legacy/models/abstract_message.js index c325113ca4e..3daf069d5d3 100644 --- a/addons/im_livechat/static/src/legacy/models/abstract_message.js +++ b/addons/im_livechat/static/src/legacy/models/abstract_message.js @@ -36,7 +36,10 @@ const AbstractMessage = Class.extend({ * @param {string} [data.message_type = undefined] */ init(parent, data) { - this._attachmentIDs = data.attachment_ids || []; + // Attachments are not supported in (public) livechat. + // We ignore data from server, otherwise field commands + // will be wrongly considered as unamed attachments. + this._attachmentIDs = []; this._body = data.body || ""; // by default: current datetime this._date = data.date ? moment(time.str_to_datetime(data.date)) : moment();