From 72b9335334c076d8deaa36e404feaa3f4d30c351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 24 Aug 2020 10:37:47 +0000 Subject: [FIX] mail, im_livechat: make livechat work properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix traceback on receiving first livechat message due to bad computation of correspondent - fix missing [0] in return of country name_get in channel_info - fix visitor/correspondent computation to work when chatting with oneself - reintroduce livechat ordered by last message in discuss sidebar - improve mock server to make these fixes possible to test - introduce corresponding tests PR: #56243 task-2323670 closes odoo/odoo#56414 X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/thread/thread.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons/mail/static/src/models/thread/thread.js') diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 74cae5d25ab..e3d48d54e35 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -779,8 +779,13 @@ function factory(dependencies) { partner !== this.env.messaging.currentPartner ); if (correspondents.length === 1) { + // 2 members chat return [['link', correspondents[0]]]; } + if (this.members.length === 1) { + // chat with oneself + return [['link', this.members[0]]]; + } return [['unlink']]; } @@ -1360,6 +1365,13 @@ function factory(dependencies) { messages: many2many('mail.message', { inverse: 'threads', }), + /** + * All messages that are contained on this channel on the server. + * Equivalent to the inverse of python field `channel_ids`. + */ + messagesAsServerChannel: many2many('mail.message', { + inverse: 'serverChannels', + }), messageSeenIndicators: one2many('mail.message_seen_indicator', { inverse: 'thread', isCausal: true, -- cgit v1.2.3