summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-09-28 16:55:09 +0000
committerSébastien Theys <seb@odoo.com>2020-09-29 11:18:29 +0000
commit2d54b3eec1500dde43583ca1599ef12be4c7cad2 (patch)
tree19056138fd5ecb8ac3815f7d6ca4caac26845a06 /addons/mail/static/src/components
parente2f3b3a4dcd74c4dd094160b65981cf07d518d4c (diff)
[FIX] mail: prevent sync fold state for non-channels
task-2346650 closes odoo/odoo#58794 X-original-commit: f5b6e78e77eac27af3b3812ac3818a67acaa1c85 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components')
-rw-r--r--addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js b/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js
index 5c59a8f3d50..ff7d6e4cc08 100644
--- a/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js
+++ b/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview_tests.js
@@ -201,6 +201,56 @@ QUnit.test('click on expand from chat window should close the chat window and op
);
});
+QUnit.test('[technical] opening a non-channel chat window should not call channel_fold', async function (assert) {
+ // channel_fold should not be called when opening non-channels in chat
+ // window, because there is no server sync of fold state for them.
+ assert.expect(3);
+
+ await this.start({
+ hasChatWindow: true,
+ async mockRPC(route, args) {
+ if (route.includes('channel_fold')) {
+ const message = "should not call channel_fold when opening a non-channel chat window";
+ assert.step(message);
+ console.error(message);
+ throw Error(message);
+ }
+ return this._super(...arguments);
+ },
+ });
+ const thread = this.env.models['mail.thread'].create({
+ id: 11,
+ model: 'mail.channel',
+ });
+ this.env.models['mail.message'].create({
+ id: 21,
+ isNeedaction: true,
+ originThread: [['link', thread]],
+ });
+ await this.createThreadNeedactionPreviewComponent({
+ threadLocalId: thread.localId,
+ });
+ assert.containsOnce(
+ document.body,
+ '.o_ThreadNeedactionPreview',
+ "should have a preview initially"
+ );
+ assert.containsNone(
+ document.body,
+ '.o_ChatWindow',
+ "should have no chat window initially"
+ );
+
+ await afterNextRender(() =>
+ document.querySelector('.o_ThreadNeedactionPreview').click()
+ );
+ assert.containsOnce(
+ document.body,
+ '.o_ChatWindow',
+ "should have opened the chat window on clicking on the preview"
+ );
+});
+
});
});
});