summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/message
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 /addons/mail/static/src/components/message
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>
Diffstat (limited to 'addons/mail/static/src/components/message')
-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
3 files changed, 38 insertions, 38 deletions
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,