diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-28 10:16:37 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-28 13:43:54 +0000 |
| commit | f9ee1cf5f904116e4d1d70a8eaf4ee1d58b18a3a (patch) | |
| tree | 89425d0677083bb9489e42d47521c4bcf1e4ff44 /addons/mail/static/src/models | |
| parent | 98e12901c97a67dc87f21647473754cd6f384d4a (diff) | |
[FIX] mail, *: rename thread viewer to thread view
The "viewer" should be the "parent" not the view itself. This distinction will
become important in a future commit to allow viewers to not display the view in
some situations.
Rename done as a standalone commit to ease diff readability.
Part of task-2310623
closes odoo/odoo#56737
X-original-commit: 1b811e6a972d72de02965adda67c5b039bee023f
Related: odoo/enterprise#12756
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models')
| -rw-r--r-- | addons/mail/static/src/models/chat_window/chat_window.js | 14 | ||||
| -rw-r--r-- | addons/mail/static/src/models/chat_window_manager/chat_window_manager.js | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/models/chatter/chatter.js | 8 | ||||
| -rw-r--r-- | addons/mail/static/src/models/composer/composer.js | 4 | ||||
| -rw-r--r-- | addons/mail/static/src/models/discuss/discuss.js | 12 | ||||
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 18 | ||||
| -rw-r--r-- | addons/mail/static/src/models/thread_cache/thread_cache.js | 8 | ||||
| -rw-r--r-- | addons/mail/static/src/models/thread_view/thread_view.js (renamed from addons/mail/static/src/models/thread_viewer/thread_viewer.js) | 24 |
8 files changed, 45 insertions, 45 deletions
diff --git a/addons/mail/static/src/models/chat_window/chat_window.js b/addons/mail/static/src/models/chat_window/chat_window.js index 81bf9b65824..ab1aa214750 100644 --- a/addons/mail/static/src/models/chat_window/chat_window.js +++ b/addons/mail/static/src/models/chat_window/chat_window.js @@ -106,7 +106,7 @@ function factory(dependencies) { unfold() { if (this.thread) { this.thread.update({ pendingFoldState: 'open' }); - this.threadViewer.addComponentHint('chat-window-unfolded'); + this.threadView.addComponentHint('chat-window-unfolded'); } else { this.update({ _isFolded: false }); } @@ -237,20 +237,20 @@ function factory(dependencies) { * @private */ async _onHideHomeMenu() { - if (!this.threadViewer) { + if (!this.threadView) { return; } - this.threadViewer.addComponentHint('home-menu-hidden'); + this.threadView.addComponentHint('home-menu-hidden'); } /** * @private */ async _onShowHomeMenu() { - if (!this.threadViewer) { + if (!this.threadView) { return; } - this.threadViewer.addComponentHint('home-menu-shown'); + this.threadView.addComponentHint('home-menu-shown'); } /** @@ -333,7 +333,7 @@ function factory(dependencies) { ], }), thread: many2one('mail.thread', { - related: 'threadViewer.thread', + related: 'threadView.thread', }), threadDisplayName: attr({ related: 'thread.displayName', @@ -341,7 +341,7 @@ function factory(dependencies) { threadFoldState: attr({ related: 'thread.foldState', }), - threadViewer: one2one('mail.thread_viewer', { + threadView: one2one('mail.thread_view', { inverse: 'chatWindow', }), /** diff --git a/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js b/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js index 5070508b621..7cdf35ba734 100644 --- a/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js +++ b/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js @@ -98,7 +98,7 @@ function factory(dependencies) { if (!chatWindow) { chatWindow = this.env.models['mail.chat_window'].create({ manager: [['link', this]], - threadViewer: [['create', { + threadView: [['create', { thread: [['link', thread]], }]], }); diff --git a/addons/mail/static/src/models/chatter/chatter.js b/addons/mail/static/src/models/chatter/chatter.js index bf3ede80027..bfd5b8e96bb 100644 --- a/addons/mail/static/src/models/chatter/chatter.js +++ b/addons/mail/static/src/models/chatter/chatter.js @@ -232,7 +232,7 @@ function factory(dependencies) { id: getMessageNextTemporaryId(), isTemporary: true, }); - this.threadViewer.update({ thread: [['link', thread]] }); + this.threadView.update({ thread: [['link', thread]] }); for (const cache of thread.caches) { cache.update({ messages: [['link', message]] }); } @@ -242,7 +242,7 @@ function factory(dependencies) { id: this.threadId, model: this.threadModel, }); - this.threadViewer.update({ thread: [['link', thread]] }); + this.threadView.update({ thread: [['link', thread]] }); } } @@ -321,14 +321,14 @@ function factory(dependencies) { dependencies: ['activitiesState'], }), thread: many2one('mail.thread', { - related: 'threadViewer.thread', + related: 'threadView.thread', }), threadAttachmentCount: attr({ default: 0, }), threadId: attr(), threadModel: attr(), - threadViewer: one2one('mail.thread_viewer', { + threadView: one2one('mail.thread_view', { default: [['create']], }), todayActivities: one2many('mail.activity', { diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index 421ca3061d2..b04430ddc5e 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -185,8 +185,8 @@ function factory(dependencies) { ); thread.loadNewMessages(); } - for (const threadViewer of this.thread.viewers) { - threadViewer.addComponentHint('current-partner-just-posted-message', messageId); + for (const threadView of this.thread.threadViews) { + threadView.addComponentHint('current-partner-just-posted-message', messageId); } this._reset(); } diff --git a/addons/mail/static/src/models/discuss/discuss.js b/addons/mail/static/src/models/discuss/discuss.js index b111c8726f8..10d92315cec 100644 --- a/addons/mail/static/src/models/discuss/discuss.js +++ b/addons/mail/static/src/models/discuss/discuss.js @@ -112,7 +112,7 @@ function factory(dependencies) { ); const chat = partner.correspondentThreads.find(thread => thread.channel_type === 'chat'); if (chat) { - this.threadViewer.update({ thread: [['link', chat]] }); + this.threadView.update({ thread: [['link', chat]] }); } else { this.env.models['mail.thread'].createChannel({ autoselect: true, @@ -160,7 +160,7 @@ function factory(dependencies) { if (!thread) { return; } - this.threadViewer.update({ + this.threadView.update({ stringifiedDomain: '[]', thread: [['link', thread]], }); @@ -303,8 +303,8 @@ function factory(dependencies) { ) { thread = this.messaging.inbox; } - if (thread && this.threadViewer && thread !== this.thread) { - this.threadViewer.update({ thread: [['link', thread]] }); + if (thread && this.threadView && thread !== this.thread) { + this.threadView.update({ thread: [['link', thread]] }); } } } @@ -453,7 +453,7 @@ function factory(dependencies) { default: "", }), thread: many2one('mail.thread', { - related: 'threadViewer.thread', + related: 'threadView.thread', }), threadId: attr({ related: 'thread.id', @@ -461,7 +461,7 @@ function factory(dependencies) { threadModel: attr({ related: 'thread.model', }), - threadViewer: one2one('mail.thread_viewer', { + threadView: one2one('mail.thread_view', { default: [['create']], isCausal: true, }), diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index e3d48d54e35..d34d295223a 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -502,9 +502,9 @@ function factory(dependencies) { (device.isMobile && this.model === 'mail.box') ) { if (resetDiscussDomain) { - discuss.threadViewer.update({ stringifiedDomain: '[]' }); + discuss.threadView.update({ stringifiedDomain: '[]' }); } - discuss.threadViewer.update({ thread: [['link', this]] }); + discuss.threadView.update({ thread: [['link', this]] }); } else { this.env.messaging.chatWindowManager.openThread(this, { mode: chatWindowMode }); } @@ -519,7 +519,7 @@ function factory(dependencies) { openExpanded() { const discuss = this.env.messaging.discuss; if (['mail.channel', 'mail.box'].includes(this.model)) { - discuss.threadViewer.update({ thread: [['link', this]] }); + discuss.threadView.update({ thread: [['link', this]] }); this.env.bus.trigger('do-action', { action: 'mail.action_discuss', options: { @@ -763,8 +763,8 @@ function factory(dependencies) { * @returns {mail.chat_window[]} */ _computeChatWindows() { - const chatWindowViewers = this.viewers.filter(viewer => !!viewer.chatWindow); - return [['replace', chatWindowViewers.map(viewer => viewer.chatWindow)]]; + const chatWindowThreadViews = this.threadViews.filter(threadView => !!threadView.chatWindow); + return [['replace', chatWindowThreadViews.map(threadView => threadView.chatWindow)]]; } /** @@ -1194,7 +1194,7 @@ function factory(dependencies) { channel_type: attr(), chatWindows: one2many('mail.chat_window', { compute: '_computeChatWindows', - dependencies: ['viewersChatWindow'], + dependencies: ['threadViewsChatWindow'], }), composer: one2one('mail.composer', { /** @@ -1472,11 +1472,11 @@ function factory(dependencies) { dependencies: ['orderedOtherTypingMembers'], }), uuid: attr(), - viewers: one2many('mail.thread_viewer', { + threadViews: one2many('mail.thread_view', { inverse: 'thread', }), - viewersChatWindow: many2many('mail.chat_window', { - related: 'viewers.chatWindow', + threadViewsChatWindow: many2many('mail.chat_window', { + related: 'threadViews.chatWindow', }), }; 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 c89ded407a3..e6147fd68a0 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -56,8 +56,8 @@ function factory(dependencies) { args: [domain], kwargs: this._getFetchMessagesKwargs(), }, { shadow: true })); - for (const viewer of this.thread.viewers) { - viewer.addComponentHint('more-messages-loaded'); + for (const threadView of this.thread.threadViews) { + threadView.addComponentHint('more-messages-loaded'); } this._handleMessagesLoaded(messagesData); } @@ -292,8 +292,8 @@ function factory(dependencies) { isLoading: false, isLoadingMore: false, }); - for (const viewer of this.thread.viewers) { - viewer.handleThreadCacheLoaded(this); + for (const threadView of this.thread.threadViews) { + threadView.handleThreadCacheLoaded(this); } } diff --git a/addons/mail/static/src/models/thread_viewer/thread_viewer.js b/addons/mail/static/src/models/thread_view/thread_view.js index 09483357993..f0075314561 100644 --- a/addons/mail/static/src/models/thread_viewer/thread_viewer.js +++ b/addons/mail/static/src/models/thread_view/thread_view.js @@ -1,4 +1,4 @@ -odoo.define('mail/static/src/models/thread_viewer/thread_viewer.js', function (require) { +odoo.define('mail/static/src/models/thread_view/thread_view.js', function (require) { 'use strict'; const { registerNewModel } = require('mail/static/src/model/model_core.js'); @@ -7,7 +7,7 @@ const { attr, many2many, many2one, one2one } = require('mail/static/src/model/mo function factory(dependencies) { - class ThreadViewer extends dependencies['mail.model'] { + class ThreadView extends dependencies['mail.model'] { /** * @override @@ -25,7 +25,7 @@ function factory(dependencies) { * This function register a hint for the component related to this * record. Hints are information on changes around this viewer that * make require adjustment on the component. For instance, if this - * thread viewer initiated a thread cache load and it now has become + * ThreadView initiated a thread cache load and it now has become * loaded, then it may need to auto-scroll to last message. * * @param {string} hintType name of the hint. Used to determine what's @@ -114,7 +114,7 @@ function factory(dependencies) { * @returns {boolean} */ _computeThreadShouldBeSetAsSeen() { - // FIXME condition should not be on "composer is focused" but "thread viewer is active" + // FIXME condition should not be on "composer is focused" but "threadView is active" // See task-2277543 const lastMessageIsVisible = this.lastVisibleMessage && this.lastVisibleMessage === this.lastMessage; @@ -196,9 +196,9 @@ function factory(dependencies) { } - ThreadViewer.fields = { + ThreadView.fields = { chatWindow: one2one('mail.chat_window', { - inverse: 'threadViewer', + inverse: 'threadView', }), checkedMessages: many2many('mail.message', { related: 'threadCache.checkedMessages', @@ -234,8 +234,8 @@ function factory(dependencies) { related: 'thread.lastMessage', }), /** - * Most recent message in the current thread viewer that has been shown - * to the current partner. + * Most recent message in this ThreadView that has been shown to the + * current partner. */ lastVisibleMessage: many2one('mail.message'), messages: many2many('mail.message', { @@ -245,7 +245,7 @@ function factory(dependencies) { default: '[]', }), thread: many2one('mail.thread', { - inverse: 'viewers', + inverse: 'threadViews', }), threadCache: many2one('mail.thread_cache', { compute: '_computeThreadCache', @@ -293,11 +293,11 @@ function factory(dependencies) { }), }; - ThreadViewer.modelName = 'mail.thread_viewer'; + ThreadView.modelName = 'mail.thread_view'; - return ThreadViewer; + return ThreadView; } -registerNewModel('mail.thread_viewer', factory); +registerNewModel('mail.thread_view', factory); }); |
