summaryrefslogtreecommitdiff
path: root/addons/sms
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-09-03 16:24:19 +0000
committerSébastien Theys <seb@odoo.com>2020-09-04 14:59:01 +0000
commit8d3413ff647de8d98c6858062dd07dde4160af95 (patch)
tree3dc134e83c874d5c7f7bf739f13a88ab986ddb1b /addons/sms
parenta5ab687be4e7890262ce9429e18dd011021513d5 (diff)
[FIX] mail, sms, snailmail: prevent message_fetch for hidden threads
Automatically load messages from a thread cache only if the thread cache is used in at least one thread view. Ensure thread viewer don't keep thread view records alive when they are not displayed. This change is particularly important for performance, to avoid spamming RPC at init if many threads are opened in chat windows. task-2310623 closes odoo/odoo#57061 X-original-commit: dd6981c7812134e0588f80a157eaba45512cd68e Related: odoo/enterprise#12936 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/sms')
-rw-r--r--addons/sms/static/src/components/message/message_tests.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/sms/static/src/components/message/message_tests.js b/addons/sms/static/src/components/message/message_tests.js
index 866fa59cf86..4eff0ae768c 100644
--- a/addons/sms/static/src/components/message/message_tests.js
+++ b/addons/sms/static/src/components/message/message_tests.js
@@ -46,7 +46,8 @@ QUnit.test('Notification Sent', async function (assert) {
assert.expect(9);
await this.start();
- const threadView = this.env.models['mail.thread_view'].create({
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ hasThreadView: true,
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -61,10 +62,10 @@ QUnit.test('Notification Sent', async function (assert) {
notification_type: 'sms',
partner: [['insert', { id: 12, name: "Someone" }]],
}]],
- originThread: [['link', threadView.thread]]
+ originThread: [['link', threadViewer.thread]]
});
await this.createMessageComponent(message, {
- threadViewLocalId: threadView.localId
+ threadViewLocalId: threadViewer.threadView.localId
});
assert.containsOnce(
@@ -137,7 +138,8 @@ QUnit.test('Notification Error', async function (assert) {
});
await this.start({ env: { bus } });
- const threadView = this.env.models['mail.thread_view'].create({
+ const threadViewer = this.env.models['mail.thread_viewer'].create({
+ hasThreadView: true,
thread: [['create', {
id: 11,
model: 'mail.channel',
@@ -151,10 +153,10 @@ QUnit.test('Notification Error', async function (assert) {
notification_status: 'exception',
notification_type: 'sms',
}]],
- originThread: [['link', threadView.thread]]
+ originThread: [['link', threadViewer.thread]]
});
await this.createMessageComponent(message, {
- threadViewLocalId: threadView.localId
+ threadViewLocalId: threadViewer.threadView.localId
});
assert.containsOnce(