diff options
Diffstat (limited to 'addons/mail/static/src/components/thread_view')
| -rw-r--r-- | addons/mail/static/src/components/thread_view/thread_view.xml | 4 | ||||
| -rw-r--r-- | addons/mail/static/src/components/thread_view/thread_view_tests.js | 43 |
2 files changed, 32 insertions, 15 deletions
diff --git a/addons/mail/static/src/components/thread_view/thread_view.xml b/addons/mail/static/src/components/thread_view/thread_view.xml index e7dd82ccf43..25e93400368 100644 --- a/addons/mail/static/src/components/thread_view/thread_view.xml +++ b/addons/mail/static/src/components/thread_view/thread_view.xml @@ -4,12 +4,12 @@ <t t-name="mail.ThreadView" owl="1"> <div class="o_ThreadView" t-att-data-correspondent-id="threadView and threadView.thread and threadView.thread.correspondent and threadView.thread.correspondent.id" 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"> + <t t-if="threadView.isLoading" 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="threadView.threadCache.isLoaded"> + <t t-elif="threadView.threadCache.isLoaded or threadView.thread.isTemporary"> <MessageList class="o_ThreadView_messageList" hasMessageCheckbox="props.hasMessageCheckbox" diff --git a/addons/mail/static/src/components/thread_view/thread_view_tests.js b/addons/mail/static/src/components/thread_view/thread_view_tests.js index c8f41632ae3..2d0b3207ae1 100644 --- a/addons/mail/static/src/components/thread_view/thread_view_tests.js +++ b/addons/mail/static/src/components/thread_view/thread_view_tests.js @@ -81,8 +81,11 @@ QUnit.test('dragover files on thread with composer', async function (assert) { name: "General", public: 'public', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView, { hasComposer: true }); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView, { hasComposer: true }); await afterNextRender(() => dragenterFiles(document.querySelector('.o_ThreadView')) ); @@ -122,8 +125,11 @@ QUnit.test('message list desc order', async function (assert) { name: "General", public: 'public', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView, { order: 'desc' }, { isFixedSize: true }); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView, { order: 'desc' }, { isFixedSize: true }); const messageItems = document.querySelectorAll(`.o_MessageList_item`); assert.notOk( messageItems[0].classList.contains("o_MessageList_loadMore"), @@ -190,8 +196,11 @@ QUnit.test('message list asc order', async function (assert) { name: "General", public: 'public', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView, { order: 'asc' }, { isFixedSize: true }); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView, { order: 'asc' }, { isFixedSize: true }); const messageItems = document.querySelectorAll(`.o_MessageList_item`); assert.notOk( messageItems[messageItems.length - 1].classList.contains("o_MessageList_loadMore"), @@ -283,8 +292,11 @@ QUnit.test('mark channel as fetched when a new message is loaded and as seen whe model: 'mail.channel', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView, { hasComposer: true }); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView, { hasComposer: true }); const notifications = [ [['myDB', 'mail.channel', 100], { channelId: 100, @@ -353,9 +365,11 @@ QUnit.test('mark channel as fetched and seen when a new message is loaded if com model: 'mail.channel', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView, { hasComposer: true }); - + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView, { hasComposer: true }); document.querySelector('.o_ComposerTextInput_textarea').focus(); const notifications = [ [['myDB', 'mail.channel', 100], { @@ -394,8 +408,11 @@ QUnit.test('show message subject if thread is mailing channel', async function ( name: "General", public: 'public', }); - const threadView = this.env.models['mail.thread_view'].create({ thread: [['link', thread]] }); - await this.createThreadViewComponent(threadView); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView); assert.containsOnce( document.body, |
