From 58118d2f1dcfb22b3c7f8b77338604fa56d23304 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Tue, 14 Dec 2021 14:54:42 +0000 Subject: [PATCH] [IMP] mail: rename thread cache model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename javascript model `mail.thread_cache` to `ThreadCache` in order to distinguish javascript models from python models. Part of task-2701674. closes odoo/odoo#81434 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/thread/thread.js | 2 +- .../mail/static/src/models/thread_cache/thread_cache.js | 2 +- addons/mail/static/src/models/thread_view/thread_view.js | 4 ++-- .../mail/static/src/models/thread_view/thread_viewer.js | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 8f9edf3f534..ba1849949c3 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -1932,7 +1932,7 @@ registerModel({ * It only makes sense for channels. */ avatarCacheKey: attr(), - cache: one2one('mail.thread_cache', { + cache: one2one('ThreadCache', { default: insertAndReplace(), inverse: 'thread', isCausal: true, diff --git a/addons/mail/static/src/models/thread_cache/thread_cache.js b/addons/mail/static/src/models/thread_cache/thread_cache.js index 18b522cb2af..a3249273262 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -6,7 +6,7 @@ import { link, replace, unlink, unlinkAll } from '@mail/model/model_field_comman import { OnChange } from '@mail/model/model_onchange'; registerModel({ - name: 'mail.thread_cache', + name: 'ThreadCache', identifyingFields: ['thread'], recordMethods: { async loadMoreMessages() { diff --git a/addons/mail/static/src/models/thread_view/thread_view.js b/addons/mail/static/src/models/thread_view/thread_view.js index 0d9f8d8531c..873561142c3 100644 --- a/addons/mail/static/src/models/thread_view/thread_view.js +++ b/addons/mail/static/src/models/thread_view/thread_view.js @@ -441,9 +441,9 @@ registerModel({ related: 'threadViewer.thread', }), /** - * States the `mail.thread_cache` currently displayed by `this`. + * States the `ThreadCache` currently displayed by `this`. */ - threadCache: many2one('mail.thread_cache', { + threadCache: many2one('ThreadCache', { inverse: 'threadViews', readonly: true, related: 'threadViewer.threadCache', diff --git a/addons/mail/static/src/models/thread_view/thread_viewer.js b/addons/mail/static/src/models/thread_view/thread_viewer.js index 43a2de2f3fb..5006b412dc0 100644 --- a/addons/mail/static/src/models/thread_view/thread_viewer.js +++ b/addons/mail/static/src/models/thread_view/thread_viewer.js @@ -10,7 +10,7 @@ registerModel({ recordMethods: { /** * @param {integer} scrollHeight - * @param {mail.thread_cache} threadCache + * @param {ThreadCache} threadCache */ saveThreadCacheScrollHeightAsInitial(scrollHeight, threadCache) { threadCache = threadCache || this.threadCache; @@ -31,7 +31,7 @@ registerModel({ }, /** * @param {integer} scrollTop - * @param {mail.thread_cache} threadCache + * @param {ThreadCache} threadCache */ saveThreadCacheScrollPositionsAsInitial(scrollTop, threadCache) { threadCache = threadCache || this.threadCache; @@ -117,9 +117,9 @@ registerModel({ */ thread: many2one('Thread'), /** - * States the `mail.thread_cache` that should be displayed by `this`. + * States the `ThreadCache` that should be displayed by `this`. */ - threadCache: many2one('mail.thread_cache', { + threadCache: many2one('ThreadCache', { related: 'thread.cache', }), /**