summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-08-28 10:16:37 +0000
committerSébastien Theys <seb@odoo.com>2020-08-28 13:43:54 +0000
commitf9ee1cf5f904116e4d1d70a8eaf4ee1d58b18a3a (patch)
tree89425d0677083bb9489e42d47521c4bcf1e4ff44
parent98e12901c97a67dc87f21647473754cd6f384d4a (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>
-rw-r--r--addons/hr_holidays/__manifest__.py2
-rw-r--r--addons/hr_holidays/static/src/components/thread_view/thread_view.js (renamed from addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js)16
-rw-r--r--addons/hr_holidays/static/src/components/thread_view/thread_view.scss (renamed from addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.scss)2
-rw-r--r--addons/hr_holidays/static/src/components/thread_view/thread_view.xml10
-rw-r--r--addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.xml10
-rw-r--r--addons/hr_holidays/views/hr_leave_template.xml4
-rw-r--r--addons/mail/__manifest__.py2
-rw-r--r--addons/mail/static/src/components/chat_window/chat_window.js4
-rw-r--r--addons/mail/static/src/components/chat_window/chat_window.scss2
-rw-r--r--addons/mail/static/src/components/chat_window/chat_window.xml4
-rw-r--r--addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js36
-rw-r--r--addons/mail/static/src/components/chatter/chatter.js2
-rw-r--r--addons/mail/static/src/components/chatter/chatter.xml4
-rw-r--r--addons/mail/static/src/components/discuss/discuss.js22
-rw-r--r--addons/mail/static/src/components/discuss/discuss.xml8
-rw-r--r--addons/mail/static/src/components/discuss/tests/discuss_tests.js88
-rw-r--r--addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js2
-rw-r--r--addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js2
-rw-r--r--addons/mail/static/src/components/message/message.js22
-rw-r--r--addons/mail/static/src/components/message/message.xml18
-rw-r--r--addons/mail/static/src/components/message/message_tests.js36
-rw-r--r--addons/mail/static/src/components/message_list/message_list.js62
-rw-r--r--addons/mail/static/src/components/message_list/message_list.xml28
-rw-r--r--addons/mail/static/src/components/thread_view/thread_view.js (renamed from addons/mail/static/src/components/thread_viewer/thread_viewer.js)26
-rw-r--r--addons/mail/static/src/components/thread_view/thread_view.scss (renamed from addons/mail/static/src/components/thread_viewer/thread_viewer.scss)12
-rw-r--r--addons/mail/static/src/components/thread_view/thread_view.xml (renamed from addons/mail/static/src/components/thread_viewer/thread_viewer.xml)26
-rw-r--r--addons/mail/static/src/components/thread_view/thread_view_tests.js (renamed from addons/mail/static/src/components/thread_viewer/thread_viewer_tests.js)56
-rw-r--r--addons/mail/static/src/models/chat_window/chat_window.js14
-rw-r--r--addons/mail/static/src/models/chat_window_manager/chat_window_manager.js2
-rw-r--r--addons/mail/static/src/models/chatter/chatter.js8
-rw-r--r--addons/mail/static/src/models/composer/composer.js4
-rw-r--r--addons/mail/static/src/models/discuss/discuss.js12
-rw-r--r--addons/mail/static/src/models/thread/thread.js18
-rw-r--r--addons/mail/static/src/models/thread_cache/thread_cache.js8
-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
-rw-r--r--addons/mail/static/src/widgets/discuss/discuss.js20
-rw-r--r--addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js2
-rw-r--r--addons/mail/views/assets.xml8
-rw-r--r--addons/sms/static/src/components/message/message_tests.js12
-rw-r--r--addons/snailmail/static/src/components/message/message_tests.js46
40 files changed, 342 insertions, 342 deletions
diff --git a/addons/hr_holidays/__manifest__.py b/addons/hr_holidays/__manifest__.py
index 906c7d9cdfc..a3823bfe8da 100644
--- a/addons/hr_holidays/__manifest__.py
+++ b/addons/hr_holidays/__manifest__.py
@@ -59,7 +59,7 @@ A synchronization with an internal agenda (Meetings of the CRM module) is also p
'static/src/bugfix/bugfix.xml',
'static/src/components/partner_im_status_icon/partner_im_status_icon.xml',
'static/src/components/thread_icon/thread_icon.xml',
- 'static/src/components/thread_viewer/thread_viewer.xml',
+ 'static/src/components/thread_view/thread_view.xml',
'static/src/xml/*.xml',
],
'installable': True,
diff --git a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js b/addons/hr_holidays/static/src/components/thread_view/thread_view.js
index 01fd38912a1..89923ff0384 100644
--- a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.js
+++ b/addons/hr_holidays/static/src/components/thread_view/thread_view.js
@@ -1,14 +1,14 @@
-odoo.define('hr_holidays/static/src/components/thread_viewer/thread_viewer.js', function (require) {
+odoo.define('hr_holidays/static/src/components/thread_view/thread_view.js', function (require) {
'use strict';
const components = {
- ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'),
+ ThreadView: require('mail/static/src/components/thread_view/thread_view.js'),
};
const { str_to_datetime } = require('web.time');
const { patch } = require('web.utils');
-patch(components.ThreadViewer, 'hr_holidays/static/src/components/thread_viewer/thread_viewer.js', {
+patch(components.ThreadView, 'hr_holidays/static/src/components/thread_view/thread_view.js', {
//--------------------------------------------------------------------------
// Public
@@ -21,14 +21,14 @@ patch(components.ThreadViewer, 'hr_holidays/static/src/components/thread_viewer/
* @returns {string}
*/
getOutOfOfficeText() {
- if (!this.threadViewer.thread.correspondent) {
+ if (!this.threadView.thread.correspondent) {
return "";
}
- if (!this.threadViewer.thread.correspondent.out_of_office_date_end) {
+ if (!this.threadView.thread.correspondent.out_of_office_date_end) {
return "";
}
const currentDate = new Date();
- const date = str_to_datetime(this.threadViewer.thread.correspondent.out_of_office_date_end);
+ const date = str_to_datetime(this.threadView.thread.correspondent.out_of_office_date_end);
const options = { day: 'numeric', month: 'short' };
if (currentDate.getFullYear() !== date.getFullYear()) {
options.year = 'numeric';
@@ -46,8 +46,8 @@ patch(components.ThreadViewer, 'hr_holidays/static/src/components/thread_viewer/
*/
_useStoreSelector(props) {
const res = this._super(...arguments);
- const threadViewer = this.env.models['mail.thread_viewer'].get(props.threadViewerLocalId);
- const thread = threadViewer ? threadViewer.thread : undefined;
+ const threadView = this.env.models['mail.thread_view'].get(props.threadViewLocalId);
+ const thread = threadView ? threadView.thread : undefined;
const correspondent = thread ? thread.correspondent : undefined;
return Object.assign({}, res, {
correspondent: correspondent ? correspondent.__state : undefined,
diff --git a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.scss b/addons/hr_holidays/static/src/components/thread_view/thread_view.scss
index 746690256ff..9cecd24e01e 100644
--- a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.scss
+++ b/addons/hr_holidays/static/src/components/thread_view/thread_view.scss
@@ -2,7 +2,7 @@
// Layout
// -----------------------------------------------------------------------------
-.o_ThreadViewer_outOfOffice {
+.o_ThreadView_outOfOffice {
margin-top: 0;
margin-bottom: 0;
}
diff --git a/addons/hr_holidays/static/src/components/thread_view/thread_view.xml b/addons/hr_holidays/static/src/components/thread_view/thread_view.xml
new file mode 100644
index 00000000000..f5e0dce55d8
--- /dev/null
+++ b/addons/hr_holidays/static/src/components/thread_view/thread_view.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+ <t t-inherit="mail.ThreadView" t-inherit-mode="extension">
+ <xpath expr="//*[@name='loadingCondition']" position="before">
+ <t t-if="threadView.thread.correspondent and threadView.thread.correspondent.out_of_office_date_end">
+ <div class="o_ThreadView_outOfOffice alert alert-primary" t-esc="getOutOfOfficeText()" role="alert"/>
+ </t>
+ </xpath>
+ </t>
+</templates>
diff --git a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.xml b/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.xml
deleted file mode 100644
index b670d5d8c61..00000000000
--- a/addons/hr_holidays/static/src/components/thread_viewer/thread_viewer.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<templates xml:space="preserve">
- <t t-inherit="mail.ThreadViewer" t-inherit-mode="extension">
- <xpath expr="//*[@name='loadingCondition']" position="before">
- <t t-if="threadViewer.thread.correspondent and threadViewer.thread.correspondent.out_of_office_date_end">
- <div class="o_ThreadViewer_outOfOffice alert alert-primary" t-esc="getOutOfOfficeText()" role="alert"/>
- </t>
- </xpath>
- </t>
-</templates>
diff --git a/addons/hr_holidays/views/hr_leave_template.xml b/addons/hr_holidays/views/hr_leave_template.xml
index e6c87afa639..f70aa21064e 100644
--- a/addons/hr_holidays/views/hr_leave_template.xml
+++ b/addons/hr_holidays/views/hr_leave_template.xml
@@ -5,7 +5,7 @@
<script type="text/javascript" src="/hr_holidays/static/src/js/time_off_calendar.js"></script>
<script type="text/javascript" src="/hr_holidays/static/src/js/leave_stats_widget.js"></script>
<script type="text/javascript" src="/hr_holidays/static/src/bugfix/bugfix.js"/>
- <script type="text/javascript" src="/hr_holidays/static/src/components/thread_viewer/thread_viewer.js"/>
+ <script type="text/javascript" src="/hr_holidays/static/src/components/thread_view/thread_view.js"/>
</xpath>
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/hr_holidays/static/scss/hr_leave_mobile.scss"/>
@@ -13,7 +13,7 @@
<link rel="stylesheet" type="text/scss" href="/hr_holidays/static/src/bugfix/bugfix.scss"/>
<link rel="stylesheet" type="text/scss" href="/hr_holidays/static/src/components/partner_im_status_icon/partner_im_status_icon.scss"/>
<link rel="stylesheet" type="text/scss" href="/hr_holidays/static/src/components/thread_icon/thread_icon.scss"/>
- <link rel="stylesheet" type="text/scss" href="/hr_holidays/static/src/components/thread_viewer/thread_viewer.scss"/>
+ <link rel="stylesheet" type="text/scss" href="/hr_holidays/static/src/components/thread_view/thread_view.scss"/>
</xpath>
</template>
<template id="qunit_suite" name="hr_holidays_qunit_suite" inherit_id="web.qunit_suite_tests">
diff --git a/addons/mail/__manifest__.py b/addons/mail/__manifest__.py
index 391fdb65431..3ded08fdda0 100644
--- a/addons/mail/__manifest__.py
+++ b/addons/mail/__manifest__.py
@@ -113,7 +113,7 @@
'static/src/components/thread_preview/thread_preview.xml',
'static/src/components/thread_textual_typing_status/thread_textual_typing_status.xml',
'static/src/components/thread_typing_icon/thread_typing_icon.xml',
- 'static/src/components/thread_viewer/thread_viewer.xml',
+ 'static/src/components/thread_view/thread_view.xml',
'static/src/widgets/common.xml',
'static/src/widgets/discuss/discuss.xml',
'static/src/widgets/discuss_invite_partner_dialog/discuss_invite_partner_dialog.xml',
diff --git a/addons/mail/static/src/components/chat_window/chat_window.js b/addons/mail/static/src/components/chat_window/chat_window.js
index 7424e32ec08..4652da4975b 100644
--- a/addons/mail/static/src/components/chat_window/chat_window.js
+++ b/addons/mail/static/src/components/chat_window/chat_window.js
@@ -4,7 +4,7 @@ odoo.define('mail/static/src/components/chat_window/chat_window.js', function (r
const components = {
AutocompleteInput: require('mail/static/src/components/autocomplete_input/autocomplete_input.js'),
ChatWindowHeader: require('mail/static/src/components/chat_window_header/chat_window_header.js'),
- ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'),
+ ThreadView: require('mail/static/src/components/thread_view/thread_view.js'),
};
const useStore = require('mail/static/src/component_hooks/use_store/use_store.js');
const { isEventHandled } = require('mail/static/src/utils/utils.js');
@@ -134,7 +134,7 @@ class ChatWindow extends Component {
* @private
*/
_saveThreadScrollTop() {
- this.chatWindow.threadViewer.saveThreadCacheScrollPositionsAsInitial(
+ this.chatWindow.threadView.saveThreadCacheScrollPositionsAsInitial(
this._threadRef.comp.getScrollTop()
);
}
diff --git a/addons/mail/static/src/components/chat_window/chat_window.scss b/addons/mail/static/src/components/chat_window/chat_window.scss
index 299da88575e..eb4d9bca14f 100644
--- a/addons/mail/static/src/components/chat_window/chat_window.scss
+++ b/addons/mail/static/src/components/chat_window/chat_window.scss
@@ -88,7 +88,7 @@
border: 1px solid gray('300'); // cancel firefox border on input focus
}
-.o_ChatWindow_thread .o_ThreadViewer_messageList {
+.o_ChatWindow_thread .o_ThreadView_messageList {
font-size: 1rem;
}
diff --git a/addons/mail/static/src/components/chat_window/chat_window.xml b/addons/mail/static/src/components/chat_window/chat_window.xml
index 76ea5005991..d711f267ac7 100644
--- a/addons/mail/static/src/components/chat_window/chat_window.xml
+++ b/addons/mail/static/src/components/chat_window/chat_window.xml
@@ -22,7 +22,7 @@
/>
<t t-if="!chatWindow.isFolded">
<t t-if="chatWindow.thread">
- <ThreadViewer
+ <ThreadView
class="o_ChatWindow_thread"
composerAttachmentsDetailsMode="'card'"
hasComposer="chatWindow.thread.model !== 'mail.box' and (!chatWindow.thread.mass_mailing or env.messaging.device.isMobile)"
@@ -30,7 +30,7 @@
hasComposerSendButton="env.messaging.device.isMobile"
hasSquashCloseMessages="chatWindow.thread.model !== 'mail.box'"
haveMessagesAuthorRedirect="chatWindow.thread.channel_type !== 'chat'"
- threadViewerLocalId="chatWindow.threadViewer.localId"
+ threadViewLocalId="chatWindow.threadView.localId"
t-on-focusin="_onFocusinThread"
t-ref="thread"
/>
diff --git a/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js b/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js
index 16e2f194df3..3306dbed905 100644
--- a/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js
+++ b/addons/mail/static/src/components/chat_window_manager/chat_window_manager_tests.js
@@ -325,8 +325,8 @@ QUnit.test('chat window: basic rendering', async function (assert) {
"should have part to display thread content inside chat window"
);
assert.ok(
- chatWindow.querySelector(`:scope .o_ChatWindow_thread`).classList.contains('o_ThreadViewer'),
- "thread viewer part should use component ThreadViewer"
+ chatWindow.querySelector(`:scope .o_ChatWindow_thread`).classList.contains('o_ThreadView'),
+ "thread part should use component ThreadView"
);
});
@@ -391,7 +391,7 @@ QUnit.test('chat window: fold', async function (assert) {
assert.containsOnce(
document.body,
'.o_ChatWindow_thread',
- "chat window should have a thread viewer"
+ "chat window should have a thread"
);
assert.verifySteps(['rpc:channel_fold/open']);
@@ -401,7 +401,7 @@ QUnit.test('chat window: fold', async function (assert) {
assert.containsNone(
document.body,
'.o_ChatWindow_thread',
- "chat window should not have any thread viewer"
+ "chat window should not have any thread"
);
// Unfold chat window
@@ -410,7 +410,7 @@ QUnit.test('chat window: fold', async function (assert) {
assert.containsOnce(
document.body,
'.o_ChatWindow_thread',
- "chat window should have a thread viewer"
+ "chat window should have a thread"
);
});
@@ -730,23 +730,23 @@ QUnit.test('[technical] chat window: scroll conservation on toggle home menu', a
document.querySelector(`.o_MessagingMenu_dropdownMenu .o_NotificationList_preview`).click()
);
// Set a scroll position to chat window
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop = 142;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop = 142;
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window initial scrollTop should be 142px"
);
await afterNextRender(() => this.hideHomeMenu());
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window scrollTop should still be the same after home menu is hidden"
);
await afterNextRender(() => this.showHomeMenu());
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window scrollTop should still be the same after home menu is shown"
);
@@ -1471,9 +1471,9 @@ QUnit.test('chat window with a thread: keep scroll position in message list on f
document.querySelector(`.o_NotificationList_preview`).click()
);
// Set a scroll position to chat window
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop = 142;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop = 142;
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"verify chat window initial scrollTop"
);
@@ -1482,14 +1482,14 @@ QUnit.test('chat window with a thread: keep scroll position in message list on f
await afterNextRender(() => document.querySelector('.o_ChatWindow_header').click());
assert.containsNone(
document.body,
- ".o_ThreadViewer",
- "chat window should be folded so no thread viewer should be present"
+ ".o_ThreadView",
+ "chat window should be folded so no ThreadView should be present"
);
// unfold chat window
await afterNextRender(() => document.querySelector('.o_ChatWindow_header').click());
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window scrollTop should still be the same when chat window is unfolded"
);
@@ -1600,9 +1600,9 @@ QUnit.test('[technical] chat window with a thread: keep scroll position in messa
document.querySelector(`.o_MessagingMenu_dropdownMenu .o_NotificationList_preview`).click()
);
// Set a scroll position to chat window
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop = 142;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop = 142;
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"should have scrolled to 142px"
);
@@ -1613,7 +1613,7 @@ QUnit.test('[technical] chat window with a thread: keep scroll position in messa
// unfold chat window
await afterNextRender(() => document.querySelector('.o_ChatWindow_header').click());
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window scrollTop should still be the same after home menu is hidden"
);
@@ -1625,7 +1625,7 @@ QUnit.test('[technical] chat window with a thread: keep scroll position in messa
// unfold chat window
await afterNextRender(() => document.querySelector('.o_ChatWindow_header').click());
assert.strictEqual(
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop,
142,
"chat window scrollTop should still be the same after home menu is shown"
);
diff --git a/addons/mail/static/src/components/chatter/chatter.js b/addons/mail/static/src/components/chatter/chatter.js
index 5503cc90d8b..61fbb78d619 100644
--- a/addons/mail/static/src/components/chatter/chatter.js
+++ b/addons/mail/static/src/components/chatter/chatter.js
@@ -6,7 +6,7 @@ const components = {
AttachmentBox: require('mail/static/src/components/attachment_box/attachment_box.js'),
ChatterTopbar: require('mail/static/src/components/chatter_topbar/chatter_topbar.js'),
Composer: require('mail/static/src/components/composer/composer.js'),
- ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'),
+ ThreadView: require('mail/static/src/components/thread_view/thread_view.js'),
};
const useStore = require('mail/static/src/component_hooks/use_store/use_store.js');
diff --git a/addons/mail/static/src/components/chatter/chatter.xml b/addons/mail/static/src/components/chatter/chatter.xml
index d31497f1122..b83c9ad733f 100644
--- a/addons/mail/static/src/components/chatter/chatter.xml
+++ b/addons/mail/static/src/components/chatter/chatter.xml
@@ -35,13 +35,13 @@
/>
</t>
<t t-if="chatter.hasThread">
- <ThreadViewer
+ <ThreadView
class="o_Chatter_thread"
hasComposer="false"
hasScrollAdjust="chatter.hasMessageListScrollAdjust"
haveMessagesAuthorRedirect="true"
order="'desc'"
- threadViewerLocalId="chatter.threadViewer.localId"
+ threadViewLocalId="chatter.threadView.localId"
t-ref="thread"
/>
</t>
diff --git a/addons/mail/static/src/components/discuss/discuss.js b/addons/mail/static/src/components/discuss/discuss.js
index 779420001bc..83aee1e201e 100644
--- a/addons/mail/static/src/components/discuss/discuss.js
+++ b/addons/mail/static/src/components/discuss/discuss.js
@@ -10,7 +10,7 @@ const components = {
ModerationDiscardDialog: require('mail/static/src/components/moderation_discard_dialog/moderation_discard_dialog.js'),
ModerationRejectDialog: require('mail/static/src/components/moderation_reject_dialog/moderation_reject_dialog.js'),
NotificationList: require('mail/static/src/components/notification_list/notification_list.js'),
- ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'),
+ ThreadView: require('mail/static/src/components/thread_view/thread_view.js'),
};
const useStore = require('mail/static/src/component_hooks/use_store/use_store.js');
@@ -27,16 +27,16 @@ class Discuss extends Component {
useStore(props => {
const discuss = this.env.messaging && this.env.messaging.discuss;
return {
- checkedMessages: discuss ? discuss.threadViewer.checkedMessages.map(message => message.__state) : [],
+ checkedMessages: discuss ? discuss.threadView.checkedMessages.map(message => message.__state) : [],
discuss: discuss ? discuss.__state : undefined,
isDeviceMobile: this.env.messaging && this.env.messaging.device.isMobile,
isMessagingInitialized: this.env.isMessagingInitialized(),
thread: discuss && discuss.thread ? discuss.thread.__state : undefined,
- threadCache: (discuss && discuss.threadViewer && discuss.threadViewer.threadCache)
- ? discuss.threadViewer.threadCache.__state
+ threadCache: (discuss && discuss.threadView && discuss.threadView.threadCache)
+ ? discuss.threadView.threadCache.__state
: undefined,
- uncheckedMessages: discuss && discuss.threadViewer
- ? discuss.threadViewer.uncheckedMessages.map(message => message.__state)
+ uncheckedMessages: discuss && discuss.threadView
+ ? discuss.threadView.uncheckedMessages.map(message => message.__state)
: [],
};
}, {
@@ -76,12 +76,12 @@ class Discuss extends Component {
if (
this.discuss.thread &&
this.discuss.thread === this.env.messaging.inbox &&
- this._lastThreadCache === this.discuss.threadViewer.threadCache.localId &&
+ this._lastThreadCache === this.discuss.threadView.threadCache.localId &&
this._lastThreadCounter > 0 && this.discuss.thread.counter === 0
) {
this.trigger('o-show-rainbow-man');
}
- this._activeThreadCache = this.discuss.threadViewer.threadCache;
+ this._activeThreadCache = this.discuss.threadView.threadCache;
this._updateLocalStoreProps();
}
@@ -149,8 +149,8 @@ class Discuss extends Component {
* rainbox man on inbox.
*/
this._lastThreadCache = (
- this.discuss.threadViewer.threadCache &&
- this.discuss.threadViewer.threadCache.localId
+ this.discuss.threadView.threadCache &&
+ this.discuss.threadView.threadCache.localId
);
/**
* Locally tracked store props `threadCounter`.
@@ -255,7 +255,7 @@ class Discuss extends Component {
* @param {mail.thread} ev.detail.thread
*/
_onSelectThread(ev) {
- this.discuss.threadViewer.update({ thread: [['link', ev.detail.thread]] });
+ this.discuss.threadView.update({ thread: [['link', ev.detail.thread]] });
}
/**
diff --git a/addons/mail/static/src/components/discuss/discuss.xml b/addons/mail/static/src/components/discuss/discuss.xml
index aa0a2edbcee..94234d0fc9b 100644
--- a/addons/mail/static/src/components/discuss/discuss.xml
+++ b/addons/mail/static/src/components/discuss/discuss.xml
@@ -22,10 +22,10 @@
</div>
</t>
<t t-if="discuss.hasModerationDiscardDialog">
- <ModerationDiscardDialog messageLocalIds="discuss.threadViewer.checkedMessages.map(message => message.localId)" t-on-dialog-closed="_onDialogClosedModerationDiscard"/>
+ <ModerationDiscardDialog messageLocalIds="discuss.threadView.checkedMessages.map(message => message.localId)" t-on-dialog-closed="_onDialogClosedModerationDiscard"/>
</t>
<t t-if="discuss.hasModerationRejectDialog">
- <ModerationRejectDialog messageLocalIds="discuss.threadViewer.checkedMessages.map(message => message.localId)" t-on-dialog-closed="_onDialogClosedModerationReject"/>
+ <ModerationRejectDialog messageLocalIds="discuss.threadView.checkedMessages.map(message => message.localId)" t-on-dialog-closed="_onDialogClosedModerationReject"/>
</t>
</t>
</div>
@@ -49,7 +49,7 @@
</div>
</t>
<t t-if="(env.messaging.device.isMobile and discuss.activeMobileNavbarTabId === 'mailbox' and discuss.thread and discuss.thread.model === 'mail.box') or (!env.messaging.device.isMobile and discuss.thread)">
- <ThreadViewer
+ <ThreadView
class="o_Discuss_thread"
t-att-class="{ 'o-mobile': env.messaging.device.isMobile }"
composerAttachmentsDetailsMode="'card'"
@@ -64,7 +64,7 @@
selectedMessageLocalId="
discuss.replyingToMessage and
discuss.replyingToMessage.localId"
- threadViewerLocalId="discuss.threadViewer.localId"
+ threadViewLocalId="discuss.threadView.localId"
t-on-o-rendered="_onThreadRendered"
/>
</t>
diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js
index 5f4fa56ab45..8c437ce5b18 100644
--- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js
+++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js
@@ -104,8 +104,8 @@ QUnit.test('basic rendering', async function (assert) {
"should have thread section inside content"
);
assert.ok(
- document.querySelector('.o_Discuss_thread').classList.contains('o_ThreadViewer'),
- "thread section should use ThreadViewer component"
+ document.querySelector('.o_Discuss_thread').classList.contains('o_ThreadView'),
+ "thread section should use ThreadView component"
);
});
@@ -497,7 +497,7 @@ QUnit.test('sidebar: basic channel rendering', async function (assert) {
"channel should become active"
);
assert.strictEqual(
- document.querySelectorAll(`.o_Discuss_thread .o_ThreadViewer_composer`).length,
+ document.querySelectorAll(`.o_Discuss_thread .o_ThreadView_composer`).length,
1,
"should have composer section inside thread content (can post message in channel)"
);
@@ -1009,14 +1009,14 @@ QUnit.test('default thread rendering', async function (assert) {
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).length,
1,
"should have empty thread in inbox"
);
assert.strictEqual(
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).textContent.trim(),
"Congratulations, your inbox is empty New messages appear here."
);
@@ -1038,14 +1038,14 @@ QUnit.test('default thread rendering', async function (assert) {
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).length,
1,
"should have empty thread in starred"
);
assert.strictEqual(
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).textContent.trim(),
"No starred messages You can mark any message as 'starred', and it shows up in this mailbox."
);
@@ -1067,7 +1067,7 @@ QUnit.test('default thread rendering', async function (assert) {
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).length,
1,
"should have empty thread in starred"
@@ -1100,14 +1100,14 @@ QUnit.test('default thread rendering', async function (assert) {
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).length,
1,
"should have empty thread in starred"
);
assert.strictEqual(
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_empty
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_empty
`).textContent.trim(),
"There are no messages in this conversation."
);
@@ -1224,7 +1224,7 @@ QUnit.test('load single message from channel initially', async function (assert)
},
});
assert.strictEqual(
- document.querySelectorAll(`.o_Discuss_thread .o_ThreadViewer_messageList`).length,
+ document.querySelectorAll(`.o_Discuss_thread .o_ThreadView_messageList`).length,
1,
"should have list of messages"
);
@@ -1282,7 +1282,7 @@ QUnit.test('basic rendering of message', async function (assert) {
});
const message = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
.o_MessageList_message[data-message-local-id="${
this.env.models['mail.message'].find(message => message.id === 100).localId
}"]
@@ -1396,21 +1396,21 @@ QUnit.test('basic rendering of squashed message', async function (assert) {
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
2,
"should have 2 messages"
);
const message1 = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
.o_MessageList_message[data-message-local-id="${
this.env.models['mail.message'].find(message => message.id === 100).localId
}"]
`);
const message2 = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
.o_MessageList_message[data-message-local-id="${
this.env.models['mail.message'].find(message => message.id === 101).localId
}"]
@@ -1502,21 +1502,21 @@ QUnit.test('inbox messages are never squashed', async function (assert) {
await this.start();
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
2,
"should have 2 messages"
);
const message1 = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
.o_MessageList_message[data-message-local-id="${
this.env.models['mail.message'].find(message => message.id === 100).localId
}"]
`);
const message2 = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
.o_MessageList_message[data-message-local-id="${
this.env.models['mail.message'].find(message => message.id === 101).localId
}"]
@@ -1562,28 +1562,28 @@ QUnit.test('load all messages from channel initially, less than fetch limit (29
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_separatorDate
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_separatorDate
`).length,
1,
"should have a single date separator" // to check: may be client timezone dependent
);
assert.strictEqual(
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_separatorLabelDate
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_separatorLabelDate
`).textContent,
"April 20, 2019",
"should display date day of messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
29,
"should have 29 messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_loadMore
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_loadMore
`).length,
0,
"should not have load more link"
@@ -1615,28 +1615,28 @@ QUnit.test('load more messages from channel', async function (assert) {
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_separatorDate
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_separatorDate
`).length,
1,
"should have a single date separator" // to check: may be client timezone dependent
);
assert.strictEqual(
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_separatorLabelDate
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_separatorLabelDate
`).textContent,
"April 20, 2019",
"should display date day of messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
30,
"should have 30 messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_loadMore
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_loadMore
`).length,
1,
"should have load more link"
@@ -1644,19 +1644,19 @@ QUnit.test('load more messages from channel', async function (assert) {
await afterNextRender(() =>
document.querySelector(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_loadMore
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_loadMore
`).click()
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
40,
"should have 40 messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_loadMore
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_loadMore
`).length,
0,
"should not longer have load more link (all messages loaded)"
@@ -1685,12 +1685,12 @@ QUnit.test('auto-scroll to bottom of thread', async function (assert) {
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
25,
"should have 25 messages"
);
- const messageList = document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`);
+ const messageList = document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`);
assert.strictEqual(
messageList.scrollTop + messageList.clientHeight,
messageList.scrollHeight,
@@ -1720,25 +1720,25 @@ QUnit.test('load more messages from channel (auto-load on scroll)', async functi
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
30,
"should have 30 messages"
);
await afterNextRender(() => {
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop = 0;
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
40,
"should have 40 messages"
);
assert.strictEqual(
document.querySelectorAll(`
- .o_Dsiscuss_thread .o_ThreadViewer_messageList .o_MessageList_loadMore
+ .o_Dsiscuss_thread .o_ThreadView_messageList .o_MessageList_loadMore
`).length,
0,
"should not longer have load more link (all messages loaded)"
@@ -1782,7 +1782,7 @@ QUnit.test('new messages separator [REQUIRE FOCUS]', async function (assert) {
"should not display 'new messages' separator"
);
// scroll to top
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop = 0;
// composer is focused by default, we remove that focus
document.querySelector('.o_ComposerTextInput_textarea').blur();
// simulate receiving a new message
@@ -1808,8 +1808,8 @@ QUnit.test('new messages separator [REQUIRE FOCUS]', async function (assert) {
"should display 'new messages' separator"
);
await afterNextRender(() => {
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop =
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollHeight;
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop =
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollHeight;
});
assert.containsOnce(
document.body,
@@ -1854,7 +1854,7 @@ QUnit.test('restore thread scroll position', async function (assert) {
});
assert.strictEqual(
document.querySelectorAll(`
- .o_Discuss_thread .o_ThreadViewer_messageList .o_MessageList_message
+ .o_Discuss_thread .o_ThreadView_messageList .o_MessageList_message
`).length,
25,
"should have 25 messages"
@@ -1862,10 +1862,10 @@ QUnit.test('restore thread scroll position', async function (assert) {
// scroll to top of channel11
await afterNextRender(() => {
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop = 0;
});
assert.strictEqual(
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop,
0,
"should have scrolled to top of thread"
);
@@ -1895,7 +1895,7 @@ QUnit.test('restore thread scroll position', async function (assert) {
`).click()
);
assert.strictEqual(
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop,
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop,
0,
"should have recovered scroll position of channel11 (scroll to top)"
);
@@ -1914,7 +1914,7 @@ QUnit.test('restore thread scroll position', async function (assert) {
);
const messageList = document.querySelector(`
.o_Discuss_thread
- .o_ThreadViewer_messageList
+ .o_ThreadView_messageList
`);
assert.strictEqual(
messageList.scrollTop + messageList.clientHeight,
@@ -3320,7 +3320,7 @@ QUnit.test('load recent messages from thread (already loaded some old messages)'
);
await afterNextRender(() => {
- document.querySelector(`.o_Discuss_thread .o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_Discuss_thread .o_ThreadView_messageList`).scrollTop = 0;
});
assert.strictEqual(
document.querySelectorAll('.o_Message').length,
diff --git a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js
index 258d7770066..cea920a45f9 100644
--- a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js
+++ b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js
@@ -74,7 +74,7 @@ class DiscussMobileMailboxSelection extends Component {
*/
_onClick(ev) {
const { mailbox } = ev.currentTarget.dataset;
- this.discuss.threadViewer.update({ thread: [['link', mailbox]] });
+ this.discuss.threadView.update({ thread: [['link', mailbox]] });
}
}
diff --git a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
index db22f9f2116..daaa8b44b5d 100644
--- a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
+++ b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
@@ -117,7 +117,7 @@ class DiscussSidebarItem extends Component {
* @param {MouseEvent} ev
*/
_onClick(ev) {
- this.discuss.threadViewer.update({ thread: [['link', this.thread]] });
+ this.discuss.threadView.update({ thread: [['link', this.thread]] });
}
/**
diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js
index 3d7c5a5bcfa..157f3dc2acd 100644
--- a/addons/mail/static/src/components/message/message.js
+++ b/addons/mail/static/src/components/message/message.js
@@ -51,10 +51,10 @@ class Message extends Component {
const author = message ? message.author : undefined;
const partnerRoot = this.env.messaging.partnerRoot;
const originThread = message ? message.originThread : undefined;
- const threadViewer = this.env.models['mail.thread_viewer'].get(props.threadViewerLocalId);
- const thread = threadViewer ? threadViewer.thread : undefined;
- const threadStringifiedDomain = threadViewer
- ? threadViewer.stringifiedDomain
+ const threadView = this.env.models['mail.thread_view'].get(props.threadViewLocalId);
+ const thread = threadView ? threadView.thread : undefined;
+ const threadStringifiedDomain = threadView
+ ? threadView.stringifiedDomain
: undefined;
return {
attachments: message
@@ -63,7 +63,7 @@ class Message extends Component {
author: author ? author.__state : undefined,
hasMessageCheckbox: message ? message.hasCheckbox : false,
isDeviceMobile: this.env.messaging.device.isMobile,
- isMessageChecked: message && threadViewer
+ isMessageChecked: message && threadView
? message.isChecked(thread, threadStringifiedDomain)
: false,
message: message ? message.__state : undefined,
@@ -71,7 +71,7 @@ class Message extends Component {
originThread: originThread ? originThread.__state : undefined,
partnerRoot: partnerRoot ? partnerRoot.__state : undefined,
thread: thread ? thread.__state : undefined,
- threadViewer: threadViewer ? threadViewer.__state : undefined,
+ threadView: threadView ? threadView.__state : undefined,
};
}, {
compareDepth: {
@@ -268,10 +268,10 @@ class Message extends Component {
}
/**
- * @returns {mail.thread_viewer}
+ * @returns {mail.thread_view}
*/
- get threadViewer() {
- return this.env.models['mail.thread_viewer'].get(this.props.threadViewerLocalId);
+ get threadView() {
+ return this.env.models['mail.thread_view'].get(this.props.threadViewLocalId);
}
/**
@@ -411,7 +411,7 @@ class Message extends Component {
* @private
*/
_onChangeCheckbox() {
- this.message.toggleCheck(this.threadViewer.thread, this.threadViewer.stringifiedDomain);
+ this.message.toggleCheck(this.threadView.thread, this.threadView.stringifiedDomain);
}
/**
@@ -601,7 +601,7 @@ Object.assign(Message, {
isSelected: Boolean,
isSquashed: Boolean,
messageLocalId: String,
- threadViewerLocalId: {
+ threadViewLocalId: {
type: String,
optional: true,
},
diff --git a/addons/mail/static/src/components/message/message.xml b/addons/mail/static/src/components/message/message.xml
index d248c422550..7739c79337a 100644
--- a/addons/mail/static/src/components/message/message.xml
+++ b/addons/mail/static/src/components/message/message.xml
@@ -49,8 +49,8 @@
/>
</t>
</div>
- <t t-if="message.isCurrentPartnerAuthor and threadViewer and threadViewer.thread and threadViewer.thread.hasSeenIndicators">
- <MessageSeenIndicator class="o_Message_seenIndicator o-message-squashed" messageLocalId="message.localId" threadLocalId="threadViewer.thread.localId"/>
+ <t t-if="message.isCurrentPartnerAuthor and threadView and threadView.thread and threadView.thread.hasSeenIndicators">
+ <MessageSeenIndicator class="o_Message_seenIndicator o-message-squashed" messageLocalId="message.localId" threadLocalId="threadView.thread.localId"/>
</t>
</t>
</div>
@@ -75,10 +75,10 @@
<div class="o_Message_date o_Message_headerDate" t-att-class="{ 'o-message-selected': props.isSelected }" t-att-title="datetime">
- <t t-esc="state.timeElapsed"/>
</div>
- <t t-if="message.isCurrentPartnerAuthor and threadViewer and threadViewer.thread">
- <MessageSeenIndicator class="o_Message_seenIndicator" messageLocalId="message.localId" threadLocalId="threadViewer.thread.localId"/>
+ <t t-if="message.isCurrentPartnerAuthor and threadView and threadView.thread">
+ <MessageSeenIndicator class="o_Message_seenIndicator" messageLocalId="message.localId" threadLocalId="threadView.thread.localId"/>
</t>
- <t t-if="threadViewer and message.originThread and message.originThread !== threadViewer.thread">
+ <t t-if="threadView and message.originThread and message.originThread !== threadView.thread">
<div class="o_Message_originThread" t-att-class="{ 'o-message-selected': props.isSelected }">
<t t-if="message.originThread.model === 'mail.channel'">
(from <a class="o_Message_originThreadLink" href="#" t-on-click="_onClickOriginThread">#<t t-esc="message.originThread.name"/></a>)
@@ -91,7 +91,7 @@
<t t-if="message.moderation_status === 'pending_moderation' and !message.isModeratedByCurrentPartner">
<span class="o_Message_moderationPending o-author" title="Your message is pending moderation.">Pending moderation</span>
</t>
- <t t-if="threadViewer and message.originThread and message.originThread === threadViewer.thread and message.notifications.length > 0">
+ <t t-if="threadView and message.originThread and message.originThread === threadView.thread and message.notifications.length > 0">
<t t-if="message.failureNotifications.length > 0">
<span class="o_Message_notificationIconContainer o-error" t-on-click="_onClickFailure">
<i name="failureIcon" class="o_Message_notificationIcon fa fa-envelope"/>
@@ -142,8 +142,8 @@
</div>
<t t-if="message.isModeratedByCurrentPartner">
<div class="o_Message_moderationSubHeader">
- <t t-if="threadViewer and props.hasCheckbox and message.hasCheckbox">
- <input class="o_Message_checkbox" type="checkbox" t-att-checked="message.isChecked(threadViewer.thread, threadViewer.stringifiedDomain) ? 'checked': ''" t-on-change="_onChangeCheckbox" t-ref="checkbox"/>
+ <t t-if="threadView and props.hasCheckbox and message.hasCheckbox">
+ <input class="o_Message_checkbox" type="checkbox" t-att-checked="message.isChecked(threadView.thread, threadView.stringifiedDomain) ? 'checked': ''" t-on-change="_onChangeCheckbox" t-ref="checkbox"/>
</t>
<span class="o_Message_moderationPending">Pending moderation:</span>
<a class="o_Message_moderationAction o-accept" href="#" title="Accept" t-on-click="_onClickModerationAccept">Accept</a>
@@ -180,7 +180,7 @@
</ul>
</t>
</div>
- <t t-if="message.subject and threadViewer and threadViewer.thread and (threadViewer.thread.mass_mailing or [env.messaging.inbox, env.messaging.history].includes(threadViewer.thread))">
+ <t t-if="message.subject and threadView and threadView.thread and (threadView.thread.mass_mailing or [env.messaging.inbox, env.messaging.history].includes(threadView.thread))">
<p class="o_Message_subject">Subject: <t t-esc="message.subject"/></p>
</t>
<t t-if="message.attachments and message.attachments.length > 0">
diff --git a/addons/mail/static/src/components/message/message_tests.js b/addons/mail/static/src/components/message/message_tests.js
index 7f10771ce0d..cc2764389f0 100644
--- a/addons/mail/static/src/components/message/message_tests.js
+++ b/addons/mail/static/src/components/message/message_tests.js
@@ -189,7 +189,7 @@ QUnit.test('Notification Sent', async function (assert) {
assert.expect(9);
await this.start();
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -204,10 +204,10 @@ QUnit.test('Notification Sent', async function (assert) {
notification_type: 'email',
partner: [['insert', { id: 12, name: "Someone" }]],
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -280,7 +280,7 @@ QUnit.test('Notification Error', async function (assert) {
});
await this.start({ env: { bus } });
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -294,10 +294,10 @@ QUnit.test('Notification Error', async function (assert) {
notification_status: 'exception',
notification_type: 'email',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -346,7 +346,7 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async f
],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const message = this.env.models['mail.message'].create({
author: [['link', currentPartner]],
body: "<p>Test</p>",
@@ -354,7 +354,7 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async f
originThread: [['link', thread]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
@@ -402,14 +402,14 @@ QUnit.test("'channel_seen' notification received is correctly handled", async fu
],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const message = this.env.models['mail.message'].create({
author: [['link', currentPartner]],
body: "<p>Test</p>",
id: 100,
originThread: [['link', thread]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
@@ -457,14 +457,14 @@ QUnit.test("'channel_fetch' notification then 'channel_seen' received are corre
],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const message = this.env.models['mail.message'].create({
author: [['link', currentPartner]],
body: "<p>Test</p>",
id: 100,
originThread: [['link', thread]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
@@ -537,14 +537,14 @@ QUnit.test('do not show messaging seen indicator if not authored by me', async f
]]],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const message = this.env.models['mail.message'].insert({
author: [['link', author]],
body: "<p>Test</p>",
id: 100,
originThread: [['link', thread]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
@@ -574,7 +574,7 @@ QUnit.test('do not show messaging seen indicator if before last seen by all mess
}]],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const lastSeenMessage = this.env.models['mail.message'].create({
author: [['link', currentPartner]],
body: "<p>You already saw me</p>",
@@ -601,7 +601,7 @@ QUnit.test('do not show messaging seen indicator if before last seen by all mess
},
]]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
@@ -649,14 +649,14 @@ QUnit.test('only show messaging seen indicator if authored by me, after last see
}]],
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
const message = this.env.models['mail.message'].insert({
author: [['link', currentPartner]],
body: "<p>Test</p>",
id: 100,
originThread: [['link', thread]],
});
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,
diff --git a/addons/mail/static/src/components/message_list/message_list.js b/addons/mail/static/src/components/message_list/message_list.js
index ba2a4eda772..0cdf4893305 100644
--- a/addons/mail/static/src/components/message_list/message_list.js
+++ b/addons/mail/static/src/components/message_list/message_list.js
@@ -18,9 +18,9 @@ class MessageList extends Component {
constructor(...args) {
super(...args);
useStore(props => {
- const threadViewer = this.env.models['mail.thread_viewer'].get(props.threadViewerLocalId);
- const thread = threadViewer ? threadViewer.thread : undefined;
- const threadCache = threadViewer ? threadViewer.threadCache : undefined;
+ const threadView = this.env.models['mail.thread_view'].get(props.threadViewLocalId);
+ const thread = threadView ? threadView.thread : undefined;
+ const threadCache = threadView ? threadView.threadCache : undefined;
return {
isDeviceMobile: this.env.messaging.device.isMobile,
messages: threadCache
@@ -28,7 +28,7 @@ class MessageList extends Component {
: [],
thread: thread ? thread.__state : undefined,
threadCache: threadCache ? threadCache.__state : undefined,
- threadViewer: threadViewer ? threadViewer.__state : undefined,
+ threadView: threadView ? threadView.__state : undefined,
};
}, {
compareDepth: {
@@ -116,12 +116,12 @@ class MessageList extends Component {
* +----------+
*
* Because of this, the scroll position must be changed when whole UI
- * is rendered. To make this simpler, this is done when <ThreadViewer/>
- * component is patched. This is acceptable when <ThreadViewer/> has a
+ * is rendered. To make this simpler, this is done when <ThreadView/>
+ * component is patched. This is acceptable when <ThreadView/> has a
* fixed height, which is the case for the moment.
*/
async adjustFromComponentHints() {
- for (const hint of this.threadViewer.componentHintList) {
+ for (const hint of this.threadView.componentHintList) {
switch (hint.type) {
case 'change-of-thread-cache':
this._adjustFromChangeOfThreadCache(hint);
@@ -142,7 +142,7 @@ class MessageList extends Component {
this._adjustFromMoreMessagesLoaded(hint);
break;
default:
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
break;
}
}
@@ -239,7 +239,7 @@ class MessageList extends Component {
* @returns {mail.message[]}
*/
get orderedMessages() {
- const threadCache = this.threadViewer.threadCache;
+ const threadCache = this.threadView.threadCache;
if (this.props.order === 'desc') {
return [...threadCache.orderedMessages].reverse();
}
@@ -308,10 +308,10 @@ class MessageList extends Component {
}
/**
- * @returns {mail.thread_viewer}
+ * @returns {mail.thread_view}
*/
- get threadViewer() {
- return this.env.models['mail.thread_viewer'].get(this.props.threadViewerLocalId);
+ get threadView() {
+ return this.env.models['mail.thread_view'].get(this.props.threadViewLocalId);
}
//--------------------------------------------------------------------------
@@ -323,15 +323,15 @@ class MessageList extends Component {
* @param {Object} hint
*/
async _adjustFromChangeOfThreadCache(hint) {
- const threadCache = this.threadViewer.threadCache;
+ const threadCache = this.threadView.threadCache;
if (!threadCache.isLoaded) {
return;
}
let isProcessed = false;
if (threadCache.messages.length > 0) {
- if (this.threadViewer.threadCacheInitialScrollPosition !== undefined) {
+ if (this.threadView.threadCacheInitialScrollPosition !== undefined) {
if (this.props.hasScrollAdjust) {
- this.el.scrollTop = this.threadViewer.threadCacheInitialScrollPosition;
+ this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition;
}
isProcessed = true;
} else {
@@ -347,7 +347,7 @@ class MessageList extends Component {
isProcessed = true;
}
if (isProcessed) {
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
}
@@ -357,7 +357,7 @@ class MessageList extends Component {
*/
_adjustFromChatWindowUnfolded(hint) {
this._adjustScrollFromModel();
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
/**
@@ -367,7 +367,7 @@ class MessageList extends Component {
* @param {integer} hint.data.messageId
*/
async _adjustFromCurrentPartnerJustPostedMessage(hint) {
- const threadCache = this.threadViewer.threadCache;
+ const threadCache = this.threadView.threadCache;
const { messageId } = hint.data;
if (threadCache.isLoaded) {
const threadCacheMessageIds = threadCache.messages.map(message => message.id);
@@ -375,7 +375,7 @@ class MessageList extends Component {
if (this.props.hasScrollAdjust) {
await this._scrollToMessage(messageId);
}
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
}
}
@@ -386,7 +386,7 @@ class MessageList extends Component {
*/
_adjustFromHomeMenuHidden(hint) {
this._adjustScrollFromModel();
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
/**
@@ -395,7 +395,7 @@ class MessageList extends Component {
*/
_adjustFromHomeMenuShown(hint) {
this._adjustScrollFromModel();
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
/**
@@ -404,14 +404,14 @@ class MessageList extends Component {
*/
_adjustFromMoreMessagesLoaded(hint) {
if (!this._willPatchSnapshot) {
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
return;
}
const { scrollHeight, scrollTop } = this._willPatchSnapshot;
if (this.props.order === 'asc' && this.props.hasScrollAdjust) {
this.el.scrollTop = this.el.scrollHeight - scrollHeight + scrollTop;
}
- this.threadViewer.markComponentHintProcessed(hint);
+ this.threadView.markComponentHintProcessed(hint);
}
/**
@@ -419,10 +419,10 @@ class MessageList extends Component {
*/
_adjustScrollFromModel() {
if (
- this.threadViewer.threadCacheInitialScrollPosition !== undefined &&
+ this.threadView.threadCacheInitialScrollPosition !== undefined &&
this.props.hasScrollAdjust
) {
- this.el.scrollTop = this.threadViewer.threadCacheInitialScrollPosition;
+ this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition;
}
}
@@ -430,8 +430,8 @@ class MessageList extends Component {
* @private
*/
_checkMostRecentMessageIsVisible() {
- const thread = this.threadViewer.thread;
- const threadCache = this.threadViewer.threadCache;
+ const thread = this.threadView.thread;
+ const threadCache = this.threadView.threadCache;
const lastMessageIsVisible =
threadCache &&
threadCache.messages.length > 0 &&
@@ -439,7 +439,7 @@ class MessageList extends Component {
threadCache === thread.mainCache &&
this.mostRecentMessageRef.isPartiallyVisible();
if (lastMessageIsVisible) {
- this.threadViewer.handleVisibleMessage(this.mostRecentMessageRef.message);
+ this.threadView.handleVisibleMessage(this.mostRecentMessageRef.message);
}
}
@@ -462,7 +462,7 @@ class MessageList extends Component {
* @private
*/
_loadMore() {
- this.threadViewer.threadCache.loadMoreMessages();
+ this.threadView.threadCache.loadMoreMessages();
}
/**
@@ -534,7 +534,7 @@ class MessageList extends Component {
// could be unmounted in the meantime (due to throttled behavior)
return;
}
- this.threadViewer.saveThreadCacheScrollPositionsAsInitial(this.el.scrollTop);
+ this.threadView.saveThreadCacheScrollPositionsAsInitial(this.el.scrollTop);
if (!this._isAutoLoadOnScrollActive) {
return;
}
@@ -572,7 +572,7 @@ Object.assign(MessageList, {
type: String,
optional: true,
},
- threadViewerLocalId: String,
+ threadViewLocalId: String,
},
template: 'mail.MessageList',
});
diff --git a/addons/mail/static/src/components/message_list/message_list.xml b/addons/mail/static/src/components/message_list/message_list.xml
index 4951bcea951..a678f7a7199 100644
--- a/addons/mail/static/src/components/message_list/message_list.xml
+++ b/addons/mail/static/src/components/message_list/message_list.xml
@@ -2,30 +2,30 @@
<templates xml:space="preserve">
<t t-name="mail.MessageList" owl="1">
- <div class="o_MessageList" t-att-class="{ 'o-empty': threadViewer and threadViewer.messages.length === 0, 'o-has-message-selection': props.selectedMessageLocalId }" t-on-scroll="_onScroll">
- <t t-if="threadViewer">
+ <div class="o_MessageList" t-att-class="{ 'o-empty': threadView and threadView.messages.length === 0, 'o-has-message-selection': props.selectedMessageLocalId }" t-on-scroll="_onScroll">
+ <t t-if="threadView">
<!-- No result messages -->
- <t t-if="threadViewer.messages.length === 0">
+ <t t-if="threadView.messages.length === 0">
<div class="o_MessageList_empty o_MessageList_item">
- <t t-if="threadViewer.thread === env.messaging.inbox">
+ <t t-if="threadView.thread === env.messaging.inbox">
<div class="o_MessageList_emptyTitle">
Congratulations, your inbox is empty
</div>
New messages appear here.
</t>
- <t t-elif="threadViewer.thread === env.messaging.starred">
+ <t t-elif="threadView.thread === env.messaging.starred">
<div class="o_MessageList_emptyTitle">
No starred messages
</div>
You can mark any message as 'starred', and it shows up in this mailbox.
</t>
- <t t-elif="threadViewer.thread === env.messaging.history">
+ <t t-elif="threadView.thread === env.messaging.history">
<div class="o_MessageList_emptyTitle o-neutral-face-icon">
No history messages
</div>
Messages marked as read will appear in the history.
</t>
- <t t-elif="threadViewer.thread === env.messaging.moderation">
+ <t t-elif="threadView.thread === env.messaging.moderation">
<div class="o_MessageList_emptyTitle">
You have no messages to moderate.
</div>
@@ -37,13 +37,13 @@
</div>
</t>
<!-- LOADING (if order asc)-->
- <t t-if="props.order === 'asc' and threadViewer.messages.length > 0">
+ <t t-if="props.order === 'asc' and threadView.messages.length > 0">
<t t-call="mail.MessageList.loadMore"/>
</t>
<!-- MESSAGES -->
<t t-set="current_day" t-value="0"/>
<t t-set="prev_message" t-value="0"/>
- <t t-if="threadViewer.thread.model === 'mail.channel' and threadViewer.thread.message_unread_counter > 0 and !threadViewer.thread.seen_message_id">
+ <t t-if="threadView.thread.model === 'mail.channel' and threadView.thread.message_unread_counter > 0 and !threadView.thread.seen_message_id">
<div class="o_MessageList_separator o_MessageList_separatorNewMessages o_MessageList_item" t-att-class="{ 'o-disable-animation': env.disableAnimation }" t-transition="fade">
<hr class="o_MessageList_separatorLine o_MessageList_separatorLineNewMessages"/><span class="o_MessageList_separatorLabel o_MessageList_separatorLabelNewMessages">New messages</span>
</div>
@@ -72,18 +72,18 @@
isSelected="props.selectedMessageLocalId === message.localId"
isSquashed="isMessageSquashed"
messageLocalId="message.localId"
- threadViewerLocalId="threadViewer.localId"
+ threadViewLocalId="threadView.localId"
t-ref="{{ message.localId }}"
/>
<t t-set="prev_message" t-value="message"/>
- <t t-if="threadViewer.thread.model === 'mail.channel' and threadViewer.thread.message_unread_counter > 0 and threadViewer.thread.seen_message_id === message.id">
+ <t t-if="threadView.thread.model === 'mail.channel' and threadView.thread.message_unread_counter > 0 and threadView.thread.seen_message_id === message.id">
<div class="o_MessageList_separator o_MessageList_separatorNewMessages o_MessageList_item" t-att-class="{ 'o-disable-animation': env.disableAnimation }" t-transition="fade">
<hr class="o_MessageList_separatorLine o_MessageList_separatorLineNewMessages"/><span class="o_MessageList_separatorLabel o_MessageList_separatorLabelNewMessages">New messages</span>
</div>
</t>
</t>
<!-- LOADING (if order desc)-->
- <t t-if="props.order === 'desc' and threadViewer.messages.length > 0">
+ <t t-if="props.order === 'desc' and threadView.messages.length > 0">
<t t-call="mail.MessageList.loadMore"/>
</t>
</t>
@@ -91,13 +91,13 @@
</t>
<t t-name="mail.MessageList.loadMore" owl="1">
- <t t-if="threadViewer.threadCache.isLoadingMore">
+ <t t-if="threadView.threadCache.isLoadingMore">
<div class="o_MessageList_item o_MessageList_isLoadingMore">
<i class="o_MessageList_isLoadingMoreIcon fa fa-spin fa-spinner"/>
Loading...
</div>
</t>
- <t t-elif="!threadViewer.threadCache.isAllHistoryLoaded">
+ <t t-elif="!threadView.threadCache.isAllHistoryLoaded">
<a class="o_MessageList_item o_MessageList_loadMore" href="#" t-on-click="_onClickLoadMore" t-ref="loadMore">
Load more
</a>
diff --git a/addons/mail/static/src/components/thread_viewer/thread_viewer.js b/addons/mail/static/src/components/thread_view/thread_view.js
index 8e8f8f14dbb..7b1680f31a8 100644
--- a/addons/mail/static/src/components/thread_viewer/thread_viewer.js
+++ b/addons/mail/static/src/components/thread_view/thread_view.js
@@ -1,4 +1,4 @@
-odoo.define('mail/static/src/components/thread_viewer/thread_viewer.js', function (require) {
+odoo.define('mail/static/src/components/thread_view/thread_view.js', function (require) {
'use strict';
const components = {
@@ -10,7 +10,7 @@ const useStore = require('mail/static/src/component_hooks/use_store/use_store.js
const { Component } = owl;
const { useRef } = owl.hooks;
-class ThreadViewer extends Component {
+class ThreadView extends Component {
/**
* @param {...any} args
@@ -74,10 +74,10 @@ class ThreadViewer extends Component {
}
/**
- * @returns {mail.thread_viewer}
+ * @returns {mail.thread_view}
*/
- get threadViewer() {
- return this.env.models['mail.thread_viewer'].get(this.props.threadViewerLocalId);
+ get threadView() {
+ return this.env.models['mail.thread_view'].get(this.props.threadViewLocalId);
}
//--------------------------------------------------------------------------
@@ -112,20 +112,20 @@ class ThreadViewer extends Component {
* @returns {Object}
*/
_useStoreSelector(props) {
- const threadViewer = this.env.models['mail.thread_viewer'].get(props.threadViewerLocalId);
- const thread = threadViewer ? threadViewer.thread : undefined;
- const threadCache = threadViewer ? threadViewer.threadCache : undefined;
+ const threadView = this.env.models['mail.thread_view'].get(props.threadViewLocalId);
+ const thread = threadView ? threadView.thread : undefined;
+ const threadCache = threadView ? threadView.threadCache : undefined;
return {
isDeviceMobile: this.env.messaging.device.isMobile,
thread: thread ? thread.__state : undefined,
threadCache: threadCache ? threadCache.__state : undefined,
- threadViewer: threadViewer ? threadViewer.__state : undefined,
+ threadView: threadView ? threadView.__state : undefined,
};
}
}
-Object.assign(ThreadViewer, {
+Object.assign(ThreadView, {
components,
defaultProps: {
composerAttachmentsDetailsMode: 'auto',
@@ -181,11 +181,11 @@ Object.assign(ThreadViewer, {
},
showComposerAttachmentsExtensions: Boolean,
showComposerAttachmentsFilenames: Boolean,
- threadViewerLocalId: String,
+ threadViewLocalId: String,
},
- template: 'mail.ThreadViewer',
+ template: 'mail.ThreadView',
});
-return ThreadViewer;
+return ThreadView;
});
diff --git a/addons/mail/static/src/components/thread_viewer/thread_viewer.scss b/addons/mail/static/src/components/thread_view/thread_view.scss
index 9b39a493979..0db54501341 100644
--- a/addons/mail/static/src/components/thread_viewer/thread_viewer.scss
+++ b/addons/mail/static/src/components/thread_view/thread_view.scss
@@ -2,25 +2,25 @@
// Layout
// ------------------------------------------------------------------
-.o_ThreadViewer {
+.o_ThreadView {
display: flex;
position: relative;
flex-flow: column;
overflow: auto;
}
-.o_ThreadViewer_composer {
+.o_ThreadView_composer {
flex: 0 0 auto;
}
-.o_ThreadViewer_loading {
+.o_ThreadView_loading {
display: flex;
align-self: center;
flex: 1 1 auto;
align-items: center;
}
-.o_ThreadViewer_messageList {
+.o_ThreadView_messageList {
flex: 1 1 auto;
}
@@ -28,11 +28,11 @@
// Style
// ------------------------------------------------------------------
-.o_ThreadViewer {
+.o_ThreadView {
background-color: gray('100');
}
-.o_ThreadViewer_loadingIcon {
+.o_ThreadView_loadingIcon {
margin-right: 3px;
}
diff --git a/addons/mail/static/src/components/thread_viewer/thread_viewer.xml b/addons/mail/static/src/components/thread_view/thread_view.xml
index 93202f6e423..30844135e65 100644
--- a/addons/mail/static/src/components/thread_viewer/thread_viewer.xml
+++ b/addons/mail/static/src/components/thread_view/thread_view.xml
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
- <t t-name="mail.ThreadViewer" owl="1">
- <div class="o_ThreadViewer" t-att-data-thread-local-id="threadViewer and threadViewer.thread and threadViewer.thread.localId">
- <t t-if="threadViewer">
- <t t-if="threadViewer.isShowingLoading" name="loadingCondition">
- <div class="o_ThreadViewer_loading">
- <span><i class="o_ThreadViewer_loadingIcon fa fa-spinner fa-spin" title="Loading..." role="img"/>Loading...</span>
+ <t t-name="mail.ThreadView" owl="1">
+ <div class="o_ThreadView" t-att-data-thread-local-id="threadView and threadView.thread and threadView.thread.localId">
+ <t t-if="threadView">
+ <t t-if="threadView.isShowingLoading" name="loadingCondition">
+ <div class="o_ThreadView_loading">
+ <span><i class="o_ThreadView_loadingIcon fa fa-spinner fa-spin" title="Loading..." role="img"/>Loading...</span>
</div>
</t>
- <t t-elif="threadViewer.threadCache.isLoaded">
+ <t t-elif="threadView.threadCache.isLoaded">
<MessageList
- class="o_ThreadViewer_messageList"
+ class="o_ThreadView_messageList"
hasMessageCheckbox="props.hasMessageCheckbox"
hasScrollAdjust="props.hasScrollAdjust"
hasSquashCloseMessages="props.hasSquashCloseMessages"
@@ -20,20 +20,20 @@
haveMessagesReplyIcon="props.haveMessagesReplyIcon"
order="props.order"
selectedMessageLocalId="props.selectedMessageLocalId"
- threadViewerLocalId="threadViewer.localId"
+ threadViewLocalId="threadView.localId"
t-ref="messageList"
/>
</t>
<t t-if="props.hasComposer">
<Composer
- class="o_ThreadViewer_composer"
+ class="o_ThreadView_composer"
attachmentsDetailsMode="props.composerAttachmentsDetailsMode"
- composerLocalId="threadViewer.thread.composer.localId"
+ composerLocalId="threadView.thread.composer.localId"
hasCurrentPartnerAvatar="props.hasComposerCurrentPartnerAvatar"
hasSendButton="props.hasComposerSendButton"
- hasTextInputSendOnEnterEnabled="(threadViewer.thread.model === 'mail.channel' and threadViewer.thread.mass_mailing) ? false : undefined"
+ hasTextInputSendOnEnterEnabled="(threadView.thread.model === 'mail.channel' and threadView.thread.mass_mailing) ? false : undefined"
hasThreadTyping="props.hasComposerThreadTyping"
- isCompact="(threadViewer.thread.model === 'mail.channel' and threadViewer.thread.mass_mailing) ? false : undefined"
+ isCompact="(threadView.thread.model === 'mail.channel' and threadView.thread.mass_mailing) ? false : undefined"
showAttachmentsExtensions="props.showComposerAttachmentsExtensions"
showAttachmentsFilenames="props.showComposerAttachmentsFilenames"
t-ref="composer"
diff --git a/addons/mail/static/src/components/thread_viewer/thread_viewer_tests.js b/addons/mail/static/src/components/thread_view/thread_view_tests.js
index 31a56bfb1f1..06832473b99 100644
--- a/addons/mail/static/src/components/thread_viewer/thread_viewer_tests.js
+++ b/addons/mail/static/src/components/thread_view/thread_view_tests.js
@@ -1,8 +1,8 @@
-odoo.define('mail/static/src/components/thread_viewer/thread_viewer_tests.js', function (require) {
+odoo.define('mail/static/src/components/thread_view/thread_view_tests.js', function (require) {
'use strict';
const components = {
- ThreadViewer: require('mail/static/src/components/thread_viewer/thread_viewer.js'),
+ ThreadView: require('mail/static/src/components/thread_view/thread_view.js'),
};
const {
afterEach,
@@ -15,18 +15,18 @@ const {
QUnit.module('mail', {}, function () {
QUnit.module('components', {}, function () {
-QUnit.module('thread_viewer', {}, function () {
-QUnit.module('thread_viewer_tests.js', {
+QUnit.module('thread_view', {}, function () {
+QUnit.module('thread_view_tests.js', {
beforeEach() {
beforeEach(this);
/**
- * @param {mail.thread_viewer} threadViewer
+ * @param {mail.thread_view} threadView
* @param {Object} [otherProps={}]
* @param {Object} [param2={}]
* @param {boolean} [param2.isFixedSize=false]
*/
- this.createThreadViewerComponent = async (threadViewer, otherProps = {}, { isFixedSize = false } = {}) => {
+ this.createThreadViewComponent = async (threadView, otherProps = {}, { isFixedSize = false } = {}) => {
let target;
if (isFixedSize) {
// needed to allow scrolling in some tests
@@ -41,8 +41,8 @@ QUnit.module('thread_viewer_tests.js', {
} else {
target = this.widget.el;
}
- const props = Object.assign({ threadViewerLocalId: threadViewer.localId }, otherProps);
- await createRootComponent(this, components.ThreadViewer, { props, target });
+ const props = Object.assign({ threadViewLocalId: threadView.localId }, otherProps);
+ await createRootComponent(this, components.ThreadView, { props, target });
};
this.start = async params => {
@@ -81,10 +81,10 @@ QUnit.test('dragover files on thread with composer', async function (assert) {
name: "General",
public: 'public',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer, { hasComposer: true });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView, { hasComposer: true });
await afterNextRender(() =>
- dragenterFiles(document.querySelector('.o_ThreadViewer'))
+ dragenterFiles(document.querySelector('.o_ThreadView'))
);
assert.ok(
document.querySelector('.o_Composer_dropZone'),
@@ -122,8 +122,8 @@ QUnit.test('message list desc order', async function (assert) {
name: "General",
public: 'public',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer, { order: 'desc' }, { isFixedSize: true });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView, { order: 'desc' }, { isFixedSize: true });
const messageItems = document.querySelectorAll(`.o_MessageList_item`);
assert.notOk(
messageItems[0].classList.contains("o_MessageList_loadMore"),
@@ -141,8 +141,8 @@ QUnit.test('message list desc order', async function (assert) {
// scroll to bottom
await afterNextRender(() => {
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop =
- document.querySelector(`.o_ThreadViewer_messageList`).scrollHeight;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop =
+ document.querySelector(`.o_ThreadView_messageList`).scrollHeight;
});
assert.strictEqual(
document.querySelectorAll(`.o_Message`).length,
@@ -151,7 +151,7 @@ QUnit.test('message list desc order', async function (assert) {
);
await afterNextRender(() => {
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop = 0;
});
assert.strictEqual(
document.querySelectorAll(`.o_Message`).length,
@@ -190,8 +190,8 @@ QUnit.test('message list asc order', async function (assert) {
name: "General",
public: 'public',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer, { order: 'asc' }, { isFixedSize: true });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView, { order: 'asc' }, { isFixedSize: true });
const messageItems = document.querySelectorAll(`.o_MessageList_item`);
assert.notOk(
messageItems[messageItems.length - 1].classList.contains("o_MessageList_loadMore"),
@@ -209,7 +209,7 @@ QUnit.test('message list asc order', async function (assert) {
// scroll to top
await afterNextRender(() => {
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop = 0;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop = 0;
});
assert.strictEqual(
document.querySelectorAll(`.o_Message`).length,
@@ -219,8 +219,8 @@ QUnit.test('message list asc order', async function (assert) {
// scroll to bottom
await afterNextRender(() => {
- document.querySelector(`.o_ThreadViewer_messageList`).scrollTop =
- document.querySelector(`.o_ThreadViewer_messageList`).scrollHeight;
+ document.querySelector(`.o_ThreadView_messageList`).scrollTop =
+ document.querySelector(`.o_ThreadView_messageList`).scrollHeight;
});
assert.strictEqual(
document.querySelectorAll(`.o_Message`).length,
@@ -283,8 +283,8 @@ QUnit.test('mark channel as fetched when a new message is loaded and as seen whe
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer, { hasComposer: true });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView, { hasComposer: true });
const notifications = [
[['myDB', 'mail.channel', 100], {
channelId: 100,
@@ -307,7 +307,7 @@ QUnit.test('mark channel as fetched when a new message is loaded and as seen whe
await afterNextRender(() => thread.composer.focus());
assert.verifySteps(
['rpc:channel_seen'],
- "Channel should have been marked as seen after threadViewer got the focus"
+ "Channel should have been marked as seen after threadView got the focus"
);
});
@@ -353,8 +353,8 @@ QUnit.test('mark channel as fetched and seen when a new message is loaded if com
model: 'mail.channel',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer, { hasComposer: true });
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView, { hasComposer: true });
const notifications = [
[['myDB', 'mail.channel', 100], {
channelId: 100,
@@ -392,8 +392,8 @@ QUnit.test('show message subject if thread is mailing channel', async function (
name: "General",
public: 'public',
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
- await this.createThreadViewerComponent(threadViewer);
+ const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] });
+ await this.createThreadViewComponent(threadView);
assert.containsOnce(
document.body,
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);
});
diff --git a/addons/mail/static/src/widgets/discuss/discuss.js b/addons/mail/static/src/widgets/discuss/discuss.js
index e830bffb774..bf389ee69bc 100644
--- a/addons/mail/static/src/widgets/discuss/discuss.js
+++ b/addons/mail/static/src/widgets/discuss/discuss.js
@@ -192,7 +192,7 @@ const DiscussWidget = AbstractAction.extend({
this.$buttons
.find('.o_widget_Discuss_controlPanelButtonMarkAllRead')
.removeClass('o_hidden')
- .prop('disabled', this.discuss.threadViewer.messages.length === 0);
+ .prop('disabled', this.discuss.threadView.messages.length === 0);
} else {
this.$buttons
.find('.o_widget_Discuss_controlPanelButtonMarkAllRead')
@@ -206,7 +206,7 @@ const DiscussWidget = AbstractAction.extend({
this.$buttons
.find('.o_unstar_all')
.removeClass('o_hidden')
- .prop('disabled', this.discuss.threadViewer.messages.length === 0);
+ .prop('disabled', this.discuss.threadView.messages.length === 0);
} else {
this.$buttons
.find('.o_unstar_all')
@@ -243,13 +243,13 @@ const DiscussWidget = AbstractAction.extend({
const $unselectAll = this.$buttons.find('.o_widget_Discuss_controlPanelButtonUnselectAll');
if (
- this.discuss.threadViewer.checkedMessages.length > 0 ||
- this.discuss.threadViewer.uncheckedMessages.length > 0
+ this.discuss.threadView.checkedMessages.length > 0 ||
+ this.discuss.threadView.uncheckedMessages.length > 0
) {
$selectAll.removeClass('o_hidden');
- $selectAll.toggleClass('disabled', this.discuss.threadViewer.uncheckedMessages.length === 0);
+ $selectAll.toggleClass('disabled', this.discuss.threadView.uncheckedMessages.length === 0);
$unselectAll.removeClass('o_hidden');
- $unselectAll.toggleClass('disabled', this.discuss.threadViewer.checkedMessages.length === 0);
+ $unselectAll.toggleClass('disabled', this.discuss.threadView.checkedMessages.length === 0);
} else {
$selectAll.addClass('o_hidden');
$selectAll.addClass('disabled');
@@ -260,8 +260,8 @@ const DiscussWidget = AbstractAction.extend({
// Moderation Actions
const $moderationButtons = this.$buttons.find('.o_widget_Discuss_controlPanelButtonModeration');
if (
- this.discuss.threadViewer.checkedMessages.length > 0 &&
- this.discuss.threadViewer.checkedMessages.filter(
+ this.discuss.threadView.checkedMessages.length > 0 &&
+ this.discuss.threadView.checkedMessages.filter(
message => !message.isModeratedByCurrentPartner
).length === 0
) {
@@ -326,7 +326,7 @@ const DiscussWidget = AbstractAction.extend({
*/
_onClickModerationAccept() {
this.env.models['mail.message'].moderate(
- this.discuss.threadViewer.checkedMessages,
+ this.discuss.threadView.checkedMessages,
'accept'
);
},
@@ -371,7 +371,7 @@ const DiscussWidget = AbstractAction.extend({
* @param {Object} searchQuery
*/
_onSearch: function (searchQuery) {
- this.discuss.threadViewer.update({
+ this.discuss.threadView.update({
stringifiedDomain: JSON.stringify(searchQuery.domain),
});
},
diff --git a/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js b/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js
index a3a38d5f140..465745feb41 100644
--- a/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js
+++ b/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js
@@ -815,7 +815,7 @@ QUnit.test('Form view not scrolled when switching record', async function (asser
await afterNextRender(async () => {
controllerContentEl.scrollTop = controllerContentEl.scrollHeight - controllerContentEl.offsetHeight;
await triggerEvent(
- document.querySelector('.o_ThreadViewer_messageList'),
+ document.querySelector('.o_ThreadView_messageList'),
'scroll'
);
});
diff --git a/addons/mail/views/assets.xml b/addons/mail/views/assets.xml
index bd51d45550f..1b8d194df66 100644
--- a/addons/mail/views/assets.xml
+++ b/addons/mail/views/assets.xml
@@ -113,7 +113,7 @@
<script type="text/javascript" src="/mail/static/src/components/thread_preview/thread_preview.js"></script>
<script type="text/javascript" src="/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js"></script>
<script type="text/javascript" src="/mail/static/src/components/thread_typing_icon/thread_typing_icon.js"></script>
- <script type="text/javascript" src="/mail/static/src/components/thread_viewer/thread_viewer.js"></script>
+ <script type="text/javascript" src="/mail/static/src/components/thread_view/thread_view.js"></script>
<script type="text/javascript" src="/mail/static/src/model/model_core.js"></script>
<script type="text/javascript" src="/mail/static/src/model/model_errors.js"></script>
<script type="text/javascript" src="/mail/static/src/model/model_field.js"></script>
@@ -150,7 +150,7 @@
<script type="text/javascript" src="/mail/static/src/models/thread/thread.js"></script>
<script type="text/javascript" src="/mail/static/src/models/thread_cache/thread_cache.js"></script>
<script type="text/javascript" src="/mail/static/src/models/thread_partner_seen_info/thread_partner_seen_info.js"></script>
- <script type="text/javascript" src="/mail/static/src/models/thread_viewer/thread_viewer.js"></script>
+ <script type="text/javascript" src="/mail/static/src/models/thread_view/thread_view.js"></script>
<script type="text/javascript" src="/mail/static/src/models/user/user.js"></script>
<script type="text/javascript" src="/mail/static/src/services/chat_window_service/chat_window_service.js"></script>
<script type="text/javascript" src="/mail/static/src/services/dialog_service/dialog_service.js"></script>
@@ -214,7 +214,7 @@
<link rel="stylesheet" type="text/scss" href="/mail/static/src/components/thread_preview/thread_preview.scss"/>
<link rel="stylesheet" type="text/scss" href="/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.scss"/>
<link rel="stylesheet" type="text/scss" href="/mail/static/src/components/thread_typing_icon/thread_typing_icon.scss"/>
- <link rel="stylesheet" type="text/scss" href="/mail/static/src/components/thread_viewer/thread_viewer.scss"/>
+ <link rel="stylesheet" type="text/scss" href="/mail/static/src/components/thread_view/thread_view.scss"/>
<link rel="stylesheet" type="text/scss" href="/mail/static/src/widgets/discuss/discuss.scss"/>
<link rel="stylesheet" type="text/scss" href="/mail/static/src/widgets/form_renderer/form_renderer.scss"/>
</xpath>
@@ -285,7 +285,7 @@
<script type="text/javascript" src="/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js"></script>
<script type="text/javascript" src="/mail/static/src/components/thread_preview/thread_preview_tests.js"/>
<script type="text/javascript" src="/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status_tests.js"></script>
- <script type="text/javascript" src="/mail/static/src/components/thread_viewer/thread_viewer_tests.js"></script>
+ <script type="text/javascript" src="/mail/static/src/components/thread_view/thread_view_tests.js"></script>
<script type="text/javascript" src="/mail/static/src/models/attachment/attachment_tests.js"></script>
<script type="text/javascript" src="/mail/static/src/models/message/message_tests.js"></script>
<script type="text/javascript" src="/mail/static/src/models/messaging/messaging_tests.js"></script>
diff --git a/addons/sms/static/src/components/message/message_tests.js b/addons/sms/static/src/components/message/message_tests.js
index 91a2926626f..866fa59cf86 100644
--- a/addons/sms/static/src/components/message/message_tests.js
+++ b/addons/sms/static/src/components/message/message_tests.js
@@ -46,7 +46,7 @@ QUnit.test('Notification Sent', async function (assert) {
assert.expect(9);
await this.start();
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -61,10 +61,10 @@ QUnit.test('Notification Sent', async function (assert) {
notification_type: 'sms',
partner: [['insert', { id: 12, name: "Someone" }]],
}]],
- originThread: [['link', threadViewer.thread]]
+ originThread: [['link', threadView.thread]]
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -137,7 +137,7 @@ QUnit.test('Notification Error', async function (assert) {
});
await this.start({ env: { bus } });
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -151,10 +151,10 @@ QUnit.test('Notification Error', async function (assert) {
notification_status: 'exception',
notification_type: 'sms',
}]],
- originThread: [['link', threadViewer.thread]]
+ originThread: [['link', threadView.thread]]
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
diff --git a/addons/snailmail/static/src/components/message/message_tests.js b/addons/snailmail/static/src/components/message/message_tests.js
index 5736cbecf5a..fca1ba5237c 100644
--- a/addons/snailmail/static/src/components/message/message_tests.js
+++ b/addons/snailmail/static/src/components/message/message_tests.js
@@ -46,7 +46,7 @@ QUnit.test('Sent', async function (assert) {
assert.expect(8);
await this.start();
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -60,10 +60,10 @@ QUnit.test('Sent', async function (assert) {
notification_status: 'sent',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -116,7 +116,7 @@ QUnit.test('Canceled', async function (assert) {
assert.expect(8);
await this.start();
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -130,10 +130,10 @@ QUnit.test('Canceled', async function (assert) {
notification_status: 'canceled',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -186,7 +186,7 @@ QUnit.test('Pending', async function (assert) {
assert.expect(8);
await this.start();
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -200,10 +200,10 @@ QUnit.test('Pending', async function (assert) {
notification_status: 'ready',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -263,7 +263,7 @@ QUnit.test('No Price Available', async function (assert) {
return this._super(...arguments);
},
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -278,10 +278,10 @@ QUnit.test('No Price Available', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -349,7 +349,7 @@ QUnit.test('Credit Error', async function (assert) {
return this._super(...arguments);
},
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -364,10 +364,10 @@ QUnit.test('Credit Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -440,7 +440,7 @@ QUnit.test('Trial Error', async function (assert) {
return this._super(...arguments);
},
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -455,10 +455,10 @@ QUnit.test('Trial Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -539,7 +539,7 @@ QUnit.test('Format Error', async function (assert) {
});
await this.start({ env: { bus } });
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -554,10 +554,10 @@ QUnit.test('Format Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
- originThread: [['link', threadViewer.thread]],
+ originThread: [['link', threadView.thread]],
});
await this.createMessageComponent(message, {
- threadViewerLocalId: threadViewer.localId
+ threadViewLocalId: threadView.localId
});
assert.containsOnce(
@@ -627,11 +627,11 @@ QUnit.test('Missing Required Fields', async function (assert) {
await this.start({
env: { bus },
});
- const threadViewer = this.env.models['mail.thread_viewer'].create({
+ const threadView = this.env.models['mail.thread_view'].create({
thread: [['insert', { id: 20, model: 'res.partner' }]],
});
const message = this.env.models['mail.message'].find(message => message.id === 10);
- await this.createMessageComponent(message, { threadViewerLocalId: threadViewer.localId });
+ await this.createMessageComponent(message, { threadViewLocalId: threadView.localId });
assert.containsOnce(
document.body,