diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-05 14:03:05 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-05 15:09:34 +0000 |
| commit | 9216bdcb6f0bbb20900a33bbf7283e6e4fda1b2c (patch) | |
| tree | ce2c02403afc038f552436997fb3ba9f3ab1c1ac /addons/mail/static/src/models/thread/thread.js | |
| parent | 9432d547053605a0807e82499123c0deede23d6b (diff) | |
[FIX] mail: clean up JS relations by storing records
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) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 18 |
1 files changed, 14 insertions, 4 deletions
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']]; } /** |
