From 9216bdcb6f0bbb20900a33bbf7283e6e4fda1b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Wed, 5 Aug 2020 14:03:05 +0000 Subject: [FIX] mail: clean up JS relations by storing records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the support and the conversion from record to localId and back from localId to record. Part of task-2308312 closes odoo/odoo#55481 X-original-commit: fc5e8be4e65518770a281f0dffae07854d20073a Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/thread/thread.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (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 4459912d6f6..6b6f9a4c1d4 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -542,7 +542,7 @@ function factory(dependencies) { openExpanded() { const discuss = this.env.messaging.discuss; if (['mail.channel', 'mail.box'].includes(this.model)) { - discuss.threadViewer.update({ thread: [['replace', this]] }); + discuss.threadViewer.update({ thread: [['link', this]] }); this.env.bus.trigger('do-action', { action: 'mail.action_discuss', options: { @@ -581,6 +581,10 @@ function factory(dependencies) { * Refresh followers information from server. */ async refreshFollowers() { + if (this.isTemporary) { + this.update({ followers: [['unlink-all']] }); + return; + } // FIXME Do that with only one RPC (see task-2243180) const [{ message_follower_ids: followerIds }] = await this.async(() => this.env.services.rpc({ model: this.model, @@ -895,7 +899,7 @@ function factory(dependencies) { ) { return [['unlink-all']]; } - return [['replace', currentPartnerOrderedSeenMessages.slice().pop()]]; + return [['link', currentPartnerOrderedSeenMessages.slice().pop()]]; } /** @@ -907,7 +911,10 @@ function factory(dependencies) { length: l, [l - 1]: lastMessage, } = this.orderedMessages; - return [['replace', lastMessage]]; + if (lastMessage) { + return [['link', lastMessage]]; + } + return [['unlink']]; } /** @@ -922,7 +929,10 @@ function factory(dependencies) { length: l, [l - 1]: lastNeedactionMessage, } = orderedNeedactionMessages; - return [['replace', lastNeedactionMessage]]; + if (lastNeedactionMessage) { + return [['link', lastNeedactionMessage]]; + } + return [['unlink']]; } /** -- cgit v1.2.3