diff --git a/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js
index 4cd20d7632b..dc8ed345089 100644
--- a/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js
+++ b/addons/mail/static/src/components/discuss/tests/discuss_inbox_tests.js
@@ -411,6 +411,54 @@ QUnit.test('"reply to" composer should send message if message replied to is not
assert.verifySteps(['message_post']);
});
+QUnit.test('error notifications should not be shown in inbox', async function (assert) {
+ assert.expect(3);
+
+ Object.assign(this.data.initMessaging, {
+ channel_slots: {
+ channel_channel: [{
+ channel_type: 'channel',
+ id: 20,
+ is_pinned: true,
+ name: "General",
+ }],
+ },
+ needaction_inbox_counter: 1,
+ });
+ this.data['mail.message'].records = [{
+ author_id: [7, "Demo"],
+ body: "
Test
",
+ date: "2019-04-20 11:00:00",
+ id: 100,
+ message_type: 'comment',
+ model: 'mail.channel',
+ needaction: true,
+ needaction_partner_ids: [3],
+ notifications: [{
+ id: 11,
+ notification_status: 'exception',
+ notification_type: 'email',
+ }],
+ res_id: 20,
+ }];
+ await this.start();
+ assert.containsOnce(
+ document.body,
+ '.o_Message',
+ "should display a single message"
+ );
+ assert.containsOnce(
+ document.body,
+ '.o_Message_originThreadLink',
+ "should display origin thread link"
+ );
+ assert.containsNone(
+ document.body,
+ '.o_Message_notificationIcon',
+ "should not display any notification icon in inbox"
+ );
+});
+
QUnit.test('show subject of message in inbox', async function (assert) {
assert.expect(3);
diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js
index 1881b614d2c..146e1c66809 100644
--- a/addons/mail/static/src/components/message/message.js
+++ b/addons/mail/static/src/components/message/message.js
@@ -168,24 +168,6 @@ class Message extends Component {
return true;
}
- /**
- * Determine whether the message origin thread is the same as the context
- * of displaying this message. In other word, if the enclosing thread
- * component of this message component is linked to the origin thread of
- * this message, then the origin is the same.
- *
- * @returns {boolean}
- */
- get hasDifferentOriginThread() {
- if (!this.threadViewer) {
- return false;
- }
- if (!this.message.originThread) {
- return false;
- }
- return this.message.originThread !== this.threadViewer.thread;
- }
-
/**
* @returns {mail.attachment[]}
*/
diff --git a/addons/mail/static/src/components/message/message.xml b/addons/mail/static/src/components/message/message.xml
index fecc16d4be4..51689f70449 100644
--- a/addons/mail/static/src/components/message/message.xml
+++ b/addons/mail/static/src/components/message/message.xml
@@ -78,7 +78,7 @@
-
+
(from #)
@@ -91,7 +91,7 @@
Pending moderation
-
+
diff --git a/addons/mail/static/src/components/message/message_tests.js b/addons/mail/static/src/components/message/message_tests.js
index e1a5872d421..63ee06a4a78 100644
--- a/addons/mail/static/src/components/message/message_tests.js
+++ b/addons/mail/static/src/components/message/message_tests.js
@@ -220,6 +220,12 @@ QUnit.test('Notification Sent', async function (assert) {
assert.expect(9);
await this.start();
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'email',
@@ -229,8 +235,11 @@ QUnit.test('Notification Sent', async function (assert) {
notification_type: 'email',
partner: [['insert', { id: 12, name: "Someone" }]],
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -302,6 +311,12 @@ QUnit.test('Notification Error', async function (assert) {
});
await this.start({ env: { bus } });
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'email',
@@ -310,8 +325,11 @@ QUnit.test('Notification Error', async function (assert) {
notification_status: 'exception',
notification_type: 'email',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
diff --git a/addons/sms/static/src/components/message/message_tests.js b/addons/sms/static/src/components/message/message_tests.js
index 4c26191a5b3..5876491c6d9 100644
--- a/addons/sms/static/src/components/message/message_tests.js
+++ b/addons/sms/static/src/components/message/message_tests.js
@@ -20,12 +20,12 @@ QUnit.module('message_tests.js', {
beforeEach() {
utilsBeforeEach(this);
- this.createMessageComponent = async message => {
+ this.createMessageComponent = async (message, otherProps) => {
const MessageComponent = components.Message;
MessageComponent.env = this.env;
- this.component = new MessageComponent(null, {
+ this.component = new MessageComponent(null, Object.assign({
messageLocalId: message.localId,
- });
+ }, otherProps));
delete MessageComponent.env;
await this.component.mount(this.widget.el);
};
@@ -57,6 +57,12 @@ QUnit.test('Notification Sent', async function (assert) {
assert.expect(9);
await this.start();
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'sms',
@@ -66,8 +72,11 @@ QUnit.test('Notification Sent', async function (assert) {
notification_type: 'sms',
partner: [['insert', { id: 12, name: "Someone" }]],
}]],
+ originThread: [['link', threadViewer.thread]]
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -139,6 +148,12 @@ QUnit.test('Notification Error', async function (assert) {
});
await this.start({ env: { bus } });
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'sms',
@@ -147,8 +162,11 @@ QUnit.test('Notification Error', async function (assert) {
notification_status: 'exception',
notification_type: 'sms',
}]],
+ originThread: [['link', threadViewer.thread]]
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
diff --git a/addons/snailmail/static/src/components/message/message_tests.js b/addons/snailmail/static/src/components/message/message_tests.js
index 10f917b2bbe..01a16040e08 100644
--- a/addons/snailmail/static/src/components/message/message_tests.js
+++ b/addons/snailmail/static/src/components/message/message_tests.js
@@ -20,12 +20,12 @@ QUnit.module('message_tests.js', {
beforeEach() {
utilsBeforeEach(this);
- this.createMessageComponent = async message => {
+ this.createMessageComponent = async (message, otherProps) => {
const MessageComponent = components.Message;
MessageComponent.env = this.env;
- this.component = new MessageComponent(null, {
+ this.component = new MessageComponent(null, Object.assign({
messageLocalId: message.localId,
- });
+ }, otherProps));
delete MessageComponent.env;
await this.component.mount(this.widget.el);
};
@@ -57,6 +57,12 @@ QUnit.test('Sent', async function (assert) {
assert.expect(8);
await this.start();
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -65,8 +71,11 @@ QUnit.test('Sent', async function (assert) {
notification_status: 'sent',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -118,6 +127,12 @@ QUnit.test('Canceled', async function (assert) {
assert.expect(8);
await this.start();
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -126,8 +141,11 @@ QUnit.test('Canceled', async function (assert) {
notification_status: 'canceled',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -179,6 +197,12 @@ QUnit.test('Pending', async function (assert) {
assert.expect(8);
await this.start();
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -187,8 +211,11 @@ QUnit.test('Pending', async function (assert) {
notification_status: 'ready',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -248,6 +275,12 @@ QUnit.test('No Price Available', async function (assert) {
return this._super(...arguments);
},
});
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -257,8 +290,11 @@ QUnit.test('No Price Available', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -329,6 +365,12 @@ QUnit.test('Credit Error', async function (assert) {
return this._super(...arguments);
},
});
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -338,8 +380,11 @@ QUnit.test('Credit Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -415,6 +460,12 @@ QUnit.test('Trial Error', async function (assert) {
return this._super(...arguments);
},
});
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -424,8 +475,11 @@ QUnit.test('Trial Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -505,6 +559,12 @@ QUnit.test('Format Error', async function (assert) {
});
await this.start({ env: { bus } });
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -514,8 +574,11 @@ QUnit.test('Format Error', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]],
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,
@@ -575,6 +638,12 @@ QUnit.test('Missing Required Fields', async function (assert) {
return this._super(...arguments);
},
});
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ thread: [['create', {
+ id: 11,
+ model: 'mail.channel',
+ }]],
+ });
const message = this.env.models['mail.message'].create({
id: 10,
message_type: 'snailmail',
@@ -584,8 +653,11 @@ QUnit.test('Missing Required Fields', async function (assert) {
notification_status: 'exception',
notification_type: 'snail',
}]],
+ originThread: [['link', threadViewer.thread]]
+ });
+ await this.createMessageComponent(message, {
+ threadViewerLocalId: threadViewer.localId
});
- await this.createMessageComponent(message);
assert.containsOnce(
document.body,