From a43d662017e1c82ec6e92d72f8206ade15319ad2 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Tue, 14 Dec 2021 14:48:09 +0000 Subject: [PATCH] [IMP] mail, *: rename thread model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename javascript model `mail.thread` to `Thread` in order to distinguish javascript models from python models. Part of task-2701674. * = hr, hr_holidays, im_livechat, website_livechat closes odoo/odoo#81433 Related: odoo/enterprise#22910 Signed-off-by: Alexandre Kühn (aku) --- .../hr/static/src/models/employee/employee.js | 6 +- .../thread_icon/tests/thread_icon_tests.js | 6 +- .../thread_view/tests/thread_view_tests.js | 2 +- .../composer/tests/composer_tests.js | 2 +- .../components/discuss/tests/discuss_tests.js | 6 +- .../tests/discuss_sidebar_category_tests.js | 26 +++--- .../discuss_sidebar_category_item_tests.js | 4 +- .../tests/messaging_menu_tests.js | 4 +- .../notification_list/notification_list.js | 2 +- .../thread_icon/tests/thread_icon_tests.js | 2 +- .../thread_textual_typing_status_tests.js | 2 +- .../messaging_notification_handler.js | 2 +- .../static/src/models/thread/thread.js | 4 +- .../tests/attachment_box_tests.js | 10 +-- .../channel_member_list.js | 4 +- .../tests/chat_window_manager_tests.js | 38 ++++---- .../components/chatter/tests/chatter_tests.js | 6 +- .../composer/tests/composer_tests.js | 88 +++++++++---------- .../composer_suggested_recipient_list.js | 4 +- .../composer_suggestion.js | 2 +- ...mposer_suggestion_canned_response_tests.js | 6 +- .../composer_suggestion_channel_tests.js | 12 +-- .../composer_suggestion_command_tests.js | 6 +- .../composer_suggestion_partner_tests.js | 6 +- .../discuss/tests/discuss_pinned_tests.js | 10 +-- .../components/discuss/tests/discuss_tests.js | 66 +++++++------- .../discuss_mobile_mailbox_selection.js | 6 +- .../discuss_sidebar/discuss_sidebar.xml | 2 +- .../tests/discuss_sidebar_category_tests.js | 32 +++---- .../discuss_sidebar_category_item_tests.js | 10 +-- .../discuss_sidebar_mailbox.js | 4 +- .../components/file_uploader/file_uploader.js | 8 +- .../components/follow_button/follow_button.js | 4 +- .../tests/follow_button_tests.js | 10 +-- .../follower/tests/follower_tests.js | 10 +-- .../follower_list_menu/follower_list_menu.js | 4 +- .../tests/follower_list_menu_tests.js | 8 +- .../tests/follower_subtype_tests.js | 6 +- .../components/message/tests/message_tests.js | 16 ++-- .../message_author_prefix.js | 4 +- .../message_seen_indicator.js | 4 +- .../tests/message_seen_indicator_tests.js | 10 +-- .../tests/messaging_menu_tests.js | 18 ++-- .../notification_list/notification_list.js | 14 +-- .../rtc_call_participant_card.js | 2 +- .../rtc_invitation_card.js | 4 +- .../thread_icon/tests/thread_icon_tests.js | 2 +- .../src/components/thread_icon/thread_icon.js | 4 +- .../thread_needaction_preview.js | 4 +- .../tests/thread_preview_tests.js | 2 +- .../thread_preview/thread_preview.js | 4 +- .../thread_textual_typing_status_tests.js | 10 +-- .../thread_textual_typing_status.js | 4 +- .../thread_view/tests/thread_view_tests.js | 58 ++++++------ .../static/src/models/activity/activity.js | 2 +- .../src/models/attachment/attachment.js | 4 +- .../models/canned_response/canned_response.js | 6 +- .../models/channel_command/channel_command.js | 8 +- .../channel_invitation_form.js | 4 +- .../src/models/chat_window/chat_window.js | 6 +- .../chat_window_manager.js | 4 +- .../mail/static/src/models/chatter/chatter.js | 4 +- .../static/src/models/composer/composer.js | 8 +- .../src/models/composer_view/composer_view.js | 4 +- .../mail/static/src/models/discuss/discuss.js | 20 ++--- .../discuss_public_view.js | 2 +- .../discuss_sidebar_category_item.js | 2 +- .../static/src/models/follower/follower.js | 2 +- .../mail/static/src/models/message/message.js | 6 +- .../src/models/message/tests/message_tests.js | 12 +-- .../message_seen_indicator.js | 6 +- .../static/src/models/messaging/messaging.js | 18 ++-- .../models/messaging/tests/messaging_tests.js | 6 +- .../messaging_initializer.js | 4 +- .../models/messaging_menu/messaging_menu.js | 2 +- .../tests/messaging_menu_tests.js | 2 +- .../messaging_notification_handler.js | 30 +++---- .../notification_group/notification_group.js | 4 +- .../mail/static/src/models/partner/partner.js | 14 +-- addons/mail/static/src/models/rtc/rtc.js | 2 +- .../rtc_call_participant_card.js | 2 +- .../src/models/rtc_session/rtc_session.js | 4 +- .../suggested_recipient_info.js | 4 +- .../src/models/thread/tests/thread_tests.js | 16 ++-- .../mail/static/src/models/thread/thread.js | 56 ++++++------ .../src/models/thread_cache/thread_cache.js | 2 +- .../thread_partner_seen_info.js | 2 +- .../src/models/thread_view/thread_view.js | 4 +- .../src/models/thread_view/thread_viewer.js | 4 +- .../thread_view_topbar/thread_view_topbar.js | 2 +- addons/mail/static/src/models/user/user.js | 10 +-- .../src/models/welcome_view/welcome_view.js | 2 +- .../static/src/public/discuss_public_boot.js | 2 +- .../src/webclient/commands/mail_providers.js | 2 +- .../widgets/form_renderer/form_renderer.js | 6 +- .../messaging_notification_handler.js | 6 +- .../static/src/models/thread/thread.js | 4 +- .../static/src/models/visitor/visitor.js | 2 +- 98 files changed, 451 insertions(+), 451 deletions(-) diff --git a/addons/hr/static/src/models/employee/employee.js b/addons/hr/static/src/models/employee/employee.js index 208ccc26a87..5c37022a3ba 100644 --- a/addons/hr/static/src/models/employee/employee.js +++ b/addons/hr/static/src/models/employee/employee.js @@ -100,7 +100,7 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ async getChat() { if (!this.user && !this.hasCheckedUser) { @@ -122,8 +122,8 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @param {Object} [options] forwarded to @see `mail.thread:open()` - * @returns {mail.thread|undefined} + * @param {Object} [options] forwarded to @see `Thread:open()` + * @returns {Thread|undefined} */ async openChat(options) { const chat = await this.async(() => this.getChat()); diff --git a/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js index b9253de72c8..78125ee3e93 100644 --- a/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/hr_holidays/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -49,7 +49,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & online', asyn members: [this.data.currentPartnerId, 7], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -81,7 +81,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & away', async members: [this.data.currentPartnerId, 7], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -113,7 +113,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & offline', asy members: [this.data.currentPartnerId, 7], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js b/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js index 579900618c2..dff2c32cea1 100644 --- a/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js +++ b/addons/hr_holidays/static/src/components/thread_view/tests/thread_view_tests.js @@ -46,7 +46,7 @@ QUnit.test('out of office message on direct chat with out of office partner', as members: [this.data.currentPartnerId, 11], }]; const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); diff --git a/addons/im_livechat/static/src/components/composer/tests/composer_tests.js b/addons/im_livechat/static/src/components/composer/tests/composer_tests.js index d91f61b2240..34f3018ab1a 100644 --- a/addons/im_livechat/static/src/components/composer/tests/composer_tests.js +++ b/addons/im_livechat/static/src/components/composer/tests/composer_tests.js @@ -28,7 +28,7 @@ QUnit.test('livechat: no add attachment button', async function (assert) { assert.expect(2); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ channel_type: 'livechat', id: 10, model: 'mail.channel', diff --git a/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js b/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js index cd452a41898..5d9b736e3cf 100644 --- a/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/im_livechat/static/src/components/discuss/tests/discuss_tests.js @@ -58,7 +58,7 @@ QUnit.test('livechat in the sidebar: basic rendering', async function (assert) { ); const livechat = groupLivechat.querySelector(` .o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -278,11 +278,11 @@ QUnit.test('livechats are sorted by last activity time in the sidebar: most rece }, ); await this.start(); - const livechat11 = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const livechat11 = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); - const livechat12 = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const livechat12 = this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }); diff --git a/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js b/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js index 19fa00a03f0..68d932f71a2 100644 --- a/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js +++ b/addons/im_livechat/static/src/components/discuss_sidebar_category/tests/discuss_sidebar_category_tests.js @@ -132,7 +132,7 @@ QUnit.test('livechat - states: close manually by clicking the title', async func assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -149,7 +149,7 @@ QUnit.test('livechat - states: close manually by clicking the title', async func assert.containsNone( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -177,7 +177,7 @@ QUnit.test('livechat - states: open manually by clicking the title', async funct assert.containsNone( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -194,7 +194,7 @@ QUnit.test('livechat - states: open manually by clicking the title', async funct assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -310,7 +310,7 @@ QUnit.test('livechat - states: close from the bus', async function (assert) { assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -328,7 +328,7 @@ QUnit.test('livechat - states: close from the bus', async function (assert) { assert.containsNone( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -356,7 +356,7 @@ QUnit.test('livechat - states: open from the bus', async function (assert) { assert.containsNone( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -374,7 +374,7 @@ QUnit.test('livechat - states: open from the bus', async function (assert) { assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -399,7 +399,7 @@ QUnit.test('livechat - states: category item should be invisible if the catgory assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -416,7 +416,7 @@ QUnit.test('livechat - states: category item should be invisible if the catgory assert.containsNone( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -440,7 +440,7 @@ QUnit.test('livechat - states: the active category item should be visble even if assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -448,7 +448,7 @@ QUnit.test('livechat - states: the active category item should be visble even if ); const livechat = document.querySelector(`.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -468,7 +468,7 @@ QUnit.test('livechat - states: the active category item should be visble even if assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId diff --git a/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js b/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js index 7f51844051d..a853e345f9d 100644 --- a/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js +++ b/addons/im_livechat/static/src/components/discuss_sidebar_category_item/tests/discuss_sidebar_category_item_tests.js @@ -42,7 +42,7 @@ QUnit.test('livechat - avatar: should have a smiley face avatar for an anonymous const livechatItem = document.querySelector(` .o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -77,7 +77,7 @@ QUnit.test('livechat - avatar: should have a partner profile picture for a livec const livechatItem = document.querySelector(` .o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId diff --git a/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js b/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js index 6b988ee921f..cf200c187f5 100644 --- a/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js +++ b/addons/im_livechat/static/src/components/messaging_menu/tests/messaging_menu_tests.js @@ -66,7 +66,7 @@ QUnit.test('livechats should be in "chat" filter', async function (assert) { assert.containsOnce( document.body, `.o_ThreadPreview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -85,7 +85,7 @@ QUnit.test('livechats should be in "chat" filter', async function (assert) { assert.containsOnce( document.body, `.o_ThreadPreview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId diff --git a/addons/im_livechat/static/src/components/notification_list/notification_list.js b/addons/im_livechat/static/src/components/notification_list/notification_list.js index dd8fcc36911..10499b86249 100644 --- a/addons/im_livechat/static/src/components/notification_list/notification_list.js +++ b/addons/im_livechat/static/src/components/notification_list/notification_list.js @@ -20,7 +20,7 @@ patch(components.NotificationList.prototype, 'im_livechat/static/src/components/ */ _getThreads(props) { if (props.filter === 'livechat') { - return this.messaging.models['mail.thread'].all(thread => + return this.messaging.models['Thread'].all(thread => thread.channel_type === 'livechat' && thread.isPinned && thread.model === 'mail.channel' diff --git a/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js index 0df8552b0ec..c96af73221a 100644 --- a/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/im_livechat/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -46,7 +46,7 @@ QUnit.test('livechat: public website visitor is typing', async function (assert) members: [this.data.currentPartnerId, this.data.publicPartnerId], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js b/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js index 4edfb967e31..0b5a69803b0 100644 --- a/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js +++ b/addons/im_livechat/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js @@ -46,7 +46,7 @@ QUnit.test('receive visitor typing status "is typing"', async function (assert) members: [this.data.currentPartnerId, this.data.publicPartnerId], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/im_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/im_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js index 19cf469496c..bcf44370f1f 100644 --- a/addons/im_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js +++ b/addons/im_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js @@ -22,7 +22,7 @@ patchRecordMethods('MessagingNotificationHandler', { * @override */ _handleNotificationChannelPartnerTypingStatus({ channel_id, is_typing, partner_id, partner_name }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: channel_id, model: 'mail.channel', }); diff --git a/addons/im_livechat/static/src/models/thread/thread.js b/addons/im_livechat/static/src/models/thread/thread.js index 6edf90c66c0..c7352189960 100644 --- a/addons/im_livechat/static/src/models/thread/thread.js +++ b/addons/im_livechat/static/src/models/thread/thread.js @@ -5,7 +5,7 @@ import { insert, link, unlink } from '@mail/model/model_field_command'; // ensure that the model definition is loaded before the patch import '@mail/models/thread/thread'; -patchModelMethods('mail.thread', { +patchModelMethods('Thread', { /** * @override */ @@ -52,7 +52,7 @@ patchModelMethods('mail.thread', { }, }); -patchRecordMethods('mail.thread', { +patchRecordMethods('Thread', { /** * @override */ diff --git a/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js b/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js index 513534c5cb5..b23e61f010b 100644 --- a/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js +++ b/addons/mail/static/src/components/attachment_box/tests/attachment_box_tests.js @@ -57,7 +57,7 @@ QUnit.test('base empty rendering', async function (assert) { this.data['res.partner'].records.push({ id: 100 }); await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ id: 100, model: 'res.partner', }); @@ -110,7 +110,7 @@ QUnit.test('base non-empty rendering', async function (assert) { return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ id: 100, model: 'res.partner', }); @@ -146,7 +146,7 @@ QUnit.test('attachment box: drop attachments', async function (assert) { this.data['res.partner'].records.push({ id: 100 }); await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ id: 100, model: 'res.partner', }); @@ -224,7 +224,7 @@ QUnit.test('view attachments', async function (assert) { await this.start({ hasDialog: true, }); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ attachments: [ insert({ id: 143, @@ -299,7 +299,7 @@ QUnit.test('remove attachment should ask for confirmation', async function (asse this.data['res.partner'].records.push({ id: 100 }); await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ attachments: insert({ id: 143, mimetype: 'text/plain', diff --git a/addons/mail/static/src/components/channel_member_list/channel_member_list.js b/addons/mail/static/src/components/channel_member_list/channel_member_list.js index 753c556c894..58a713e677a 100644 --- a/addons/mail/static/src/components/channel_member_list/channel_member_list.js +++ b/addons/mail/static/src/components/channel_member_list/channel_member_list.js @@ -7,10 +7,10 @@ const { Component } = owl; export class ChannelMemberList extends Component { /** - * @returns {mail.thread} + * @returns {Thread} */ get channel() { - return this.messaging.models['mail.thread'].get(this.props.channelLocalId); + return this.messaging.models['Thread'].get(this.props.channelLocalId); } } diff --git a/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js b/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js index c5be8007fb0..d19ffdacfc3 100644 --- a/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js +++ b/addons/mail/static/src/components/chat_window_manager/tests/chat_window_manager_tests.js @@ -479,7 +479,7 @@ QUnit.test('chat window: basic rendering', async function (assert) { const chatWindow = document.querySelector(`.o_ChatWindow`); assert.strictEqual( chatWindow.dataset.threadLocalId, - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId, @@ -1094,7 +1094,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -1109,7 +1109,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.strictEqual( document.querySelectorAll(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -1121,7 +1121,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.ok( document.querySelector(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -1135,7 +1135,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -1150,7 +1150,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.strictEqual( document.querySelectorAll(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -1162,7 +1162,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.strictEqual( document.querySelectorAll(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -1174,7 +1174,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.ok( document.querySelector(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -1185,7 +1185,7 @@ QUnit.test('open 2 different chat windows: enough screen width [REQUIRE FOCUS]', assert.notOk( document.querySelector(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -1445,7 +1445,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 1, model: 'mail.channel', }).localId @@ -1475,7 +1475,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 2, model: 'mail.channel', }).localId @@ -1505,7 +1505,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 3, model: 'mail.channel', }).localId @@ -1530,7 +1530,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct assert.strictEqual( document.querySelectorAll(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 1, model: 'mail.channel', }).localId @@ -1542,7 +1542,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct assert.strictEqual( document.querySelectorAll(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 3, model: 'mail.channel', }).localId @@ -1554,7 +1554,7 @@ QUnit.test('open 3 different chat windows: not enough screen width', async funct assert.ok( document.querySelector(` .o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 3, model: 'mail.channel', }).localId @@ -1583,7 +1583,7 @@ QUnit.test('chat window: switch on TAB', async function (assert) { document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 1, model: 'mail.channel', }).localId @@ -1624,7 +1624,7 @@ QUnit.test('chat window: switch on TAB', async function (assert) { document.querySelector(` .o_MessagingMenu_dropdownMenu .o_NotificationList_preview[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 2, model: 'mail.channel', }).localId @@ -2129,7 +2129,7 @@ QUnit.test('chat window does not fetch messages if hidden', async function (asse assert.containsNone( document.body, `.o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId @@ -2167,7 +2167,7 @@ QUnit.test('chat window does not fetch messages if hidden', async function (asse assert.containsOnce( document.body, `.o_ChatWindow[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId diff --git a/addons/mail/static/src/components/chatter/tests/chatter_tests.js b/addons/mail/static/src/components/chatter/tests/chatter_tests.js index 77f18c0903d..0f543a53be4 100644 --- a/addons/mail/static/src/components/chatter/tests/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/tests/chatter_tests.js @@ -77,7 +77,7 @@ QUnit.test('base rendering when chatter has no attachment', async function (asse ); assert.strictEqual( document.querySelector(`.o_Chatter_thread`).dataset.threadLocalId, - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'res.partner', }).localId, @@ -351,7 +351,7 @@ QUnit.test('should display subject when subject is not the same as the thread na subject: "Salutations, voyageur", }); await this.start(); - this.messaging.models['mail.thread'].create({ + this.messaging.models['Thread'].create({ id: 100, model: 'res.partner', name: "voyageur", @@ -386,7 +386,7 @@ QUnit.test('should not display subject when subject is the same as the thread na subject: "Salutations, voyageur", }); await this.start(); - this.messaging.models['mail.thread'].create({ + this.messaging.models['Thread'].create({ id: 100, model: 'res.partner', name: "Salutations, voyageur", diff --git a/addons/mail/static/src/components/composer/tests/composer_tests.js b/addons/mail/static/src/components/composer/tests/composer_tests.js index 134bc8fe518..c7ef81996f8 100644 --- a/addons/mail/static/src/components/composer/tests/composer_tests.js +++ b/addons/mail/static/src/components/composer/tests/composer_tests.js @@ -45,7 +45,7 @@ QUnit.test('composer text input: basic rendering when posting a message', async assert.expect(5); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ composer: insertAndReplace({ isLog: false }), id: 20, model: 'res.partner', @@ -81,7 +81,7 @@ QUnit.test('composer text input: basic rendering when logging note', async funct assert.expect(5); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ composer: insertAndReplace({ isLog: true }), id: 20, model: 'res.partner', @@ -118,7 +118,7 @@ QUnit.test('composer text input: basic rendering when linked thread is a mail.ch this.data['mail.channel'].records.push({ id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -153,7 +153,7 @@ QUnit.test('composer text input placeholder should contain channel name when thr name: 'General', }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -175,7 +175,7 @@ QUnit.test('composer text input placeholder should contain correspondent name wh members: [this.data.currentPartnerId, 7], }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -194,7 +194,7 @@ QUnit.test('add an emoji', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -223,7 +223,7 @@ QUnit.test('add an emoji after some text', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -260,7 +260,7 @@ QUnit.test('add emoji replaces (keyboard) text selection', async function (asser id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -308,7 +308,7 @@ QUnit.test('display canned response suggestions on typing ":"', async function ( id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -347,7 +347,7 @@ QUnit.test('use a canned response', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -399,7 +399,7 @@ QUnit.test('use a canned response some text', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -459,7 +459,7 @@ QUnit.test('add an emoji after a canned response', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -523,7 +523,7 @@ QUnit.test('display channel mention suggestions on typing "#"', async function ( }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -558,7 +558,7 @@ QUnit.test('mention a channel', async function (assert) { public: "groups", }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -606,7 +606,7 @@ QUnit.test('mention a channel after some text', async function (assert) { public: "groups", }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -662,7 +662,7 @@ QUnit.test('add an emoji after a channel mention', async function (assert) { public: "groups", }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -721,7 +721,7 @@ QUnit.test('display command suggestions on typing "/"', async function (assert) this.data['mail.channel'].records.push({ channel_type: 'channel', id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -759,7 +759,7 @@ QUnit.test('do not send typing notification on typing "/" command', async functi return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -788,7 +788,7 @@ QUnit.test('do not send typing notification on typing after selecting suggestion return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -821,7 +821,7 @@ QUnit.test('use a command for a specific channel type', async function (assert) this.data['mail.channel'].records.push({ channel_type: 'channel', id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -860,7 +860,7 @@ QUnit.test('command suggestion should only open if command is the first characte this.data['mail.channel'].records.push({ channel_type: 'channel', id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -903,7 +903,7 @@ QUnit.test('add an emoji after a command', async function (assert) { this.data['mail.channel'].records.push({ channel_type: 'channel', id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -973,7 +973,7 @@ QUnit.test('display partner mention suggestions on typing "@"', async function ( id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1015,7 +1015,7 @@ QUnit.test('mention a partner', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1075,7 +1075,7 @@ QUnit.test('mention a partner after some text', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1144,7 +1144,7 @@ QUnit.test('add an emoji after a partner mention', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1215,7 +1215,7 @@ QUnit.test('composer: add an attachment', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1249,7 +1249,7 @@ QUnit.test('composer: drop attachments', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1316,7 +1316,7 @@ QUnit.test('composer: paste attachments', async function (assert) { id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1358,7 +1358,7 @@ QUnit.test('composer text input cleared on message post', async function (assert return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1393,7 +1393,7 @@ QUnit.test('composer with thread typing notification status', async function (as // with a random unique id that will be referenced in the test this.data['mail.channel'].records.push({ id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1425,7 +1425,7 @@ QUnit.test('current partner notify is typing to other thread members', async fun return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1457,7 +1457,7 @@ QUnit.test('current partner is typing should not translate on textual typing sta return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1496,7 +1496,7 @@ QUnit.test('current partner notify no longer is typing to thread members after 5 return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1534,7 +1534,7 @@ QUnit.test('current partner notify is typing again to other members every 50s of return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1582,7 +1582,7 @@ QUnit.test('composer: send button is disabled if attachment upload is not finish return res; } }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1648,7 +1648,7 @@ QUnit.test('remove an attachment from composer does not need any confirmation', id: 20, }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1701,7 +1701,7 @@ QUnit.test('remove an uploading attachment', async function (assert) { return res; } }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1758,7 +1758,7 @@ QUnit.test('remove an uploading attachment aborts upload', async function (asser return res; } }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1797,7 +1797,7 @@ QUnit.test("Show a default status in the recipient status text when the thread d assert.expect(1); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ composer: insertAndReplace({ isLog: false }), id: 20, model: 'res.partner', @@ -1814,7 +1814,7 @@ QUnit.test("Show a thread name in the recipient status text.", async function (a assert.expect(1); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ name: "test name", composer: insertAndReplace({ isLog: false }), id: 20, @@ -1840,7 +1840,7 @@ QUnit.test('send message only once when button send is clicked twice quickly', a return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1881,7 +1881,7 @@ QUnit.test('[technical] does not crash when an attachment is removed before its return _super(); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -1924,7 +1924,7 @@ QUnit.test('send button on mail.channel should have "Send" as label', async func this.data['mail.channel'].records.push({ id: 20 }); const { createComposerComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/composer_suggested_recipient_list/composer_suggested_recipient_list.js b/addons/mail/static/src/components/composer_suggested_recipient_list/composer_suggested_recipient_list.js index 8242f08d8ea..5f009332fd1 100644 --- a/addons/mail/static/src/components/composer_suggested_recipient_list/composer_suggested_recipient_list.js +++ b/addons/mail/static/src/components/composer_suggested_recipient_list/composer_suggested_recipient_list.js @@ -22,10 +22,10 @@ export class ComposerSuggestedRecipientList extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js index 9aac81d3a18..68b663cf58d 100644 --- a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js +++ b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js @@ -32,7 +32,7 @@ export class ComposerSuggestion extends Component { } get isChannel() { - return this.props.modelName === "mail.thread"; + return this.props.modelName === "Thread"; } get isCommand() { diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js index fa7c25c33a7..fb665d82645 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_canned_response_tests.js @@ -27,7 +27,7 @@ QUnit.test('canned response suggestion displayed', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -54,7 +54,7 @@ QUnit.test('canned response suggestion correct data', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -101,7 +101,7 @@ QUnit.test('canned response suggestion active', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js index 751af99b5ff..1f17f95c60e 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_channel_tests.js @@ -27,13 +27,13 @@ QUnit.test('channel mention suggestion displayed', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); await createComposerSuggestionComponent(thread.composer, { isActive: true, - modelName: 'mail.thread', + modelName: 'Thread', recordLocalId: thread.localId, }); @@ -52,13 +52,13 @@ QUnit.test('channel mention suggestion correct data', async function (assert) { name: "General", }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); await createComposerSuggestionComponent(thread.composer, { isActive: true, - modelName: 'mail.thread', + modelName: 'Thread', recordLocalId: thread.localId, }); @@ -84,13 +84,13 @@ QUnit.test('channel mention suggestion active', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); await createComposerSuggestionComponent(thread.composer, { isActive: true, - modelName: 'mail.thread', + modelName: 'Thread', recordLocalId: thread.localId, }); diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js index 8ee88079dba..7c806b3515c 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_command_tests.js @@ -27,7 +27,7 @@ QUnit.test('command suggestion displayed', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -54,7 +54,7 @@ QUnit.test('command suggestion correct data', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -101,7 +101,7 @@ QUnit.test('command suggestion active', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js index 908a4250934..323a85e4842 100644 --- a/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js +++ b/addons/mail/static/src/components/composer_suggestion/tests/composer_suggestion_partner_tests.js @@ -27,7 +27,7 @@ QUnit.test('partner mention suggestion displayed', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -54,7 +54,7 @@ QUnit.test('partner mention suggestion correct data', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -107,7 +107,7 @@ QUnit.test('partner mention suggestion active', async function (assert) { this.data['mail.channel'].records.push({ id: 20 }); const { createComposerSuggestionComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js index 180e58a43af..4964d1f033f 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_pinned_tests.js @@ -44,7 +44,7 @@ QUnit.test('sidebar: pinned channel 1: init with one pinned channel', async func assert.containsOnce( document.body, `.o_DiscussSidebarCategoryItem[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -61,7 +61,7 @@ QUnit.test('sidebar: pinned channel 2: open pinned channel', async function (ass this.data['mail.channel'].records.push({ id: 20 }); await this.start(); - const threadGeneral = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const threadGeneral = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -99,7 +99,7 @@ QUnit.test('sidebar: pinned channel 3: open channel and leave it', async functio }, }); - const threadGeneral = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const threadGeneral = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -137,7 +137,7 @@ QUnit.test('sidebar: unpin channel from bus', async function (assert) { // with a random unique id that will be referenced in the test this.data['mail.channel'].records.push({ id: 20 }); await this.start(); - const threadGeneral = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const threadGeneral = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -205,7 +205,7 @@ QUnit.test('[technical] sidebar: channel group_based_subscription: mandatorily p is_pinned: false, // expected value for this test }); await this.start(); - const threadGeneral = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const threadGeneral = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js index 0f49b6de1d8..c4451b1f0dc 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -451,7 +451,7 @@ QUnit.test('sidebar: basic channel rendering', async function (assert) { `); assert.strictEqual( channel.dataset.threadLocalId, - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId, @@ -579,7 +579,7 @@ QUnit.test('sidebar: public/private channel rendering', async function (assert) document.querySelectorAll(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }).localId @@ -592,7 +592,7 @@ QUnit.test('sidebar: public/private channel rendering', async function (assert) document.querySelectorAll(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 101, model: 'mail.channel' }).localId @@ -604,7 +604,7 @@ QUnit.test('sidebar: public/private channel rendering', async function (assert) const channel1 = document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel' }).localId @@ -613,7 +613,7 @@ QUnit.test('sidebar: public/private channel rendering', async function (assert) const channel2 = document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 101, model: 'mail.channel' }).localId @@ -652,7 +652,7 @@ QUnit.test('sidebar: basic chat rendering', async function (assert) { const chat = document.querySelector(`.o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item`); assert.strictEqual( chat.dataset.threadLocalId, - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel' }).localId, @@ -770,7 +770,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { document.querySelectorAll(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -783,7 +783,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { document.querySelectorAll(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId @@ -796,7 +796,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { document.querySelectorAll(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 13, model: 'mail.channel', }).localId @@ -808,7 +808,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { const chat1 = document.querySelector(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -817,7 +817,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { const chat2 = document.querySelector(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId @@ -826,7 +826,7 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) { const chat3 = document.querySelector(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 13, model: 'mail.channel', }).localId @@ -908,7 +908,7 @@ QUnit.test('default thread rendering', async function (assert) { assert.strictEqual( document.querySelectorAll(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -998,7 +998,7 @@ QUnit.test('default thread rendering', async function (assert) { await afterNextRender(() => document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -1008,7 +1008,7 @@ QUnit.test('default thread rendering', async function (assert) { assert.ok( document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -1166,7 +1166,7 @@ QUnit.test('open channel from active_id as channel id', async function (assert) document.body, ` .o_Discuss_thread[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }).localId + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }).localId }"] `, "should have channel with ID 20 open in Discuss when providing active_id 20" @@ -1952,7 +1952,7 @@ QUnit.test('restore thread scroll position', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId @@ -1985,7 +1985,7 @@ QUnit.test('restore thread scroll position', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }).localId @@ -2015,7 +2015,7 @@ QUnit.test('restore thread scroll position', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId @@ -2082,7 +2082,7 @@ QUnit.test('redirect to author (open chat)', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 1, model: 'mail.channel', }).localId @@ -2094,7 +2094,7 @@ QUnit.test('redirect to author (open chat)', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -2130,7 +2130,7 @@ QUnit.test('redirect to author (open chat)', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 1, model: 'mail.channel', }).localId @@ -2142,7 +2142,7 @@ QUnit.test('redirect to author (open chat)', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -2199,7 +2199,7 @@ QUnit.test('sidebar quick search', async function (assert) { document.querySelector(` .o_DiscussSidebar_categoryChannel .o_DiscussSidebarCategory_item `).dataset.threadLocalId, - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 12, model: 'mail.channel', }).localId, @@ -2269,7 +2269,7 @@ QUnit.test('basic top bar rendering', async function (assert) { await afterNextRender(() => document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -2340,7 +2340,7 @@ QUnit.test('inbox: mark all messages as read', async function (assert) { assert.strictEqual( document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -2375,7 +2375,7 @@ QUnit.test('inbox: mark all messages as read', async function (assert) { assert.strictEqual( document.querySelectorAll(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }).localId @@ -2977,7 +2977,7 @@ QUnit.test('mark channel as seen on last message visible [REQUIRE FOCUS]', async assert.containsOnce( document.body, `.o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -2987,7 +2987,7 @@ QUnit.test('mark channel as seen on last message visible [REQUIRE FOCUS]', async assert.hasClass( document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -3002,7 +3002,7 @@ QUnit.test('mark channel as seen on last message visible [REQUIRE FOCUS]', async func: () => { document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -3021,7 +3021,7 @@ QUnit.test('mark channel as seen on last message visible [REQUIRE FOCUS]', async assert.doesNotHaveClass( document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -3954,7 +3954,7 @@ QUnit.test('mark channel as seen if last message is visible when switching chann func: () => { document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId @@ -3973,7 +3973,7 @@ QUnit.test('mark channel as seen if last message is visible when switching chann assert.doesNotHaveClass( document.querySelector(` .o_DiscussSidebarCategory_item[data-thread-local-id="${ - this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].findFromIdentifyingData({ id: 10, model: 'mail.channel', }).localId diff --git a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js index e57a3169995..dfc0af48f1d 100644 --- a/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js +++ b/addons/mail/static/src/components/discuss_mobile_mailbox_selection/discuss_mobile_mailbox_selection.js @@ -11,13 +11,13 @@ export class DiscussMobileMailboxSelection extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread[]} + * @returns {Thread[]} */ get orderedMailboxes() { if (!this.messaging) { return []; } - return this.messaging.models['mail.thread'] + return this.messaging.models['Thread'] .all(thread => thread.isPinned && thread.model === 'mail.box') .sort((mailbox1, mailbox2) => { if (mailbox1 === this.messaging.inbox) { @@ -57,7 +57,7 @@ export class DiscussMobileMailboxSelection extends Component { */ _onClick(ev) { const { mailboxLocalId } = ev.currentTarget.dataset; - const mailbox = this.messaging.models['mail.thread'].get(mailboxLocalId); + const mailbox = this.messaging.models['Thread'].get(mailboxLocalId); if (!mailbox) { return; } diff --git a/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml b/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml index 612952269e9..ed4b751332c 100644 --- a/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml +++ b/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml @@ -15,7 +15,7 @@
- + t.model !== 'mail.box' && t.needactionMessagesAsOriginThread.length > 0) .sort((t1, t2) => { if (t1.needactionMessagesAsOriginThread.length > 0 && t2.needactionMessagesAsOriginThread.length === 0) { @@ -124,18 +124,18 @@ export class NotificationList extends Component { const threads = this.notifications .filter(notification => notification.thread && notification.thread.exists()) .map(notification => notification.thread); - this.messaging.models['mail.thread'].loadPreviews(threads); + this.messaging.models['Thread'].loadPreviews(threads); } /** * @private * @param {Object} props * @throws {Error} in case `props.filter` is not supported - * @returns {mail.thread[]} + * @returns {Thread[]} */ _getThreads(props) { if (props.filter === 'mailbox') { - return this.messaging.models['mail.thread'] + return this.messaging.models['Thread'] .all(thread => thread.isPinned && thread.model === 'mail.box') .sort((mailbox1, mailbox2) => { if (mailbox1 === this.messaging.inbox) { @@ -155,7 +155,7 @@ export class NotificationList extends Component { mailbox1Name < mailbox2Name ? -1 : 1; }); } else if (props.filter === 'channel') { - return this.messaging.models['mail.thread'] + return this.messaging.models['Thread'] .all(thread => thread.channel_type === 'channel' && thread.isPinned && @@ -163,7 +163,7 @@ export class NotificationList extends Component { ) .sort((c1, c2) => c1.displayName < c2.displayName ? -1 : 1); } else if (props.filter === 'chat') { - return this.messaging.models['mail.thread'] + return this.messaging.models['Thread'] .all(thread => thread.isChatChannel && thread.isPinned && @@ -172,7 +172,7 @@ export class NotificationList extends Component { .sort((c1, c2) => c1.displayName < c2.displayName ? -1 : 1); } else if (props.filter === 'all') { // "All" filter is for channels and chats - return this.messaging.models['mail.thread'] + return this.messaging.models['Thread'] .all(thread => thread.isPinned && thread.model === 'mail.channel') .sort((c1, c2) => c1.displayName < c2.displayName ? -1 : 1); } else { diff --git a/addons/mail/static/src/components/rtc_call_participant_card/rtc_call_participant_card.js b/addons/mail/static/src/components/rtc_call_participant_card/rtc_call_participant_card.js index 42843706a03..ad63e31753c 100644 --- a/addons/mail/static/src/components/rtc_call_participant_card/rtc_call_participant_card.js +++ b/addons/mail/static/src/components/rtc_call_participant_card/rtc_call_participant_card.js @@ -20,7 +20,7 @@ export class RtcCallParticipantCard extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ get callParticipantCard() { return this.messaging.models['RtcCallParticipantCard'].get(this.props.callParticipantCardLocalId); diff --git a/addons/mail/static/src/components/rtc_invitation_card/rtc_invitation_card.js b/addons/mail/static/src/components/rtc_invitation_card/rtc_invitation_card.js index 2672a0d0b61..bd7664fac52 100644 --- a/addons/mail/static/src/components/rtc_invitation_card/rtc_invitation_card.js +++ b/addons/mail/static/src/components/rtc_invitation_card/rtc_invitation_card.js @@ -11,10 +11,10 @@ export class RtcInvitationCard extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging.models['Thread'].get(this.props.threadLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js b/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js index c2d4ce781f5..c2a00761368 100644 --- a/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js +++ b/addons/mail/static/src/components/thread_icon/tests/thread_icon_tests.js @@ -50,7 +50,7 @@ QUnit.test('chat: correspondent is typing', async function (assert) { members: [this.data.currentPartnerId, 17], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/thread_icon/thread_icon.js b/addons/mail/static/src/components/thread_icon/thread_icon.js index c0b4a449e1b..b4ea0c2d301 100644 --- a/addons/mail/static/src/components/thread_icon/thread_icon.js +++ b/addons/mail/static/src/components/thread_icon/thread_icon.js @@ -11,10 +11,10 @@ export class ThreadIcon extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId); } } diff --git a/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview.js b/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview.js index f5c56c89e87..db1217f3b52 100644 --- a/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview.js +++ b/addons/mail/static/src/components/thread_needaction_preview/thread_needaction_preview.js @@ -56,10 +56,10 @@ export class ThreadNeedactionPreview extends Component { } /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js b/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js index 93d339a57ad..2b5244b9e47 100644 --- a/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js +++ b/addons/mail/static/src/components/thread_preview/tests/thread_preview_tests.js @@ -56,7 +56,7 @@ QUnit.test('mark as read', async function (assert) { return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/thread_preview/thread_preview.js b/addons/mail/static/src/components/thread_preview/thread_preview.js index 397921a1e0b..1b423cb5c76 100644 --- a/addons/mail/static/src/components/thread_preview/thread_preview.js +++ b/addons/mail/static/src/components/thread_preview/thread_preview.js @@ -50,10 +50,10 @@ export class ThreadPreview extends Component { } /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js b/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js index f502f5d99e5..a7c1bbdfda6 100644 --- a/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js +++ b/addons/mail/static/src/components/thread_textual_typing_status/tests/thread_textual_typing_status_tests.js @@ -45,7 +45,7 @@ QUnit.test('receive other member typing status "is typing"', async function (ass members: [this.data.currentPartnerId, 17], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -85,7 +85,7 @@ QUnit.test('receive other member typing status "is typing" then "no longer is ty members: [this.data.currentPartnerId, 17], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -145,7 +145,7 @@ QUnit.test('assume other member typing status becomes "no longer is typing" afte await this.start({ hasTimeControl: true, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -194,7 +194,7 @@ QUnit.test ('other member typing status "is typing" refreshes 60 seconds timer o await this.start({ hasTimeControl: true, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); @@ -264,7 +264,7 @@ QUnit.test('receive several other members typing status "is typing"', async func members: [this.data.currentPartnerId, 10, 11, 12], }); await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel', }); diff --git a/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js b/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js index c132f0894a8..c25801ea8f8 100644 --- a/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js +++ b/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js @@ -11,10 +11,10 @@ export class ThreadTextualTypingStatus extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.thread} + * @returns {Thread} */ get thread() { - return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId); } } diff --git a/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js b/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js index a2ed2f997f4..fe097141b52 100644 --- a/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js +++ b/addons/mail/static/src/components/thread_view/tests/thread_view_tests.js @@ -54,7 +54,7 @@ QUnit.test('dragover files on thread with composer', async function (assert) { public: 'public', }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -103,7 +103,7 @@ QUnit.test('message list desc order', async function (assert) { public: 'public', }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -202,7 +202,7 @@ QUnit.test('message list asc order', async function (assert) { public: 'public', }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -312,7 +312,7 @@ QUnit.test('mark channel as fetched when a new message is loaded and as seen whe return this._super(...arguments); } }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -382,7 +382,7 @@ QUnit.test('mark channel as fetched and seen when a new message is loaded if com return this._super(...arguments); } }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -436,7 +436,7 @@ QUnit.test('show message subject when subject is not the same as the thread name subject: "Salutations, voyageur", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -480,7 +480,7 @@ QUnit.test('do not show message subject when subject is the same as the thread n subject: "Salutations, voyageur", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); @@ -517,7 +517,7 @@ QUnit.test('[technical] new messages separator on posting message', async functi res_id: 20, }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -588,7 +588,7 @@ QUnit.test('new messages separator on receiving new message [REQUIRE FOCUS]', as res_id: 20, }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -682,7 +682,7 @@ QUnit.test('new messages separator on posting message', async function (assert) name: "General", }]; const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -834,7 +834,7 @@ QUnit.test('should scroll to bottom on receiving new message if the list is init }); } const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -907,7 +907,7 @@ QUnit.test('should not scroll on receiving new message if the list is initially }); } const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -1165,7 +1165,7 @@ QUnit.test('Post a message containing an email address followed by a mention on name: "TestPartner", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); @@ -1209,7 +1209,7 @@ QUnit.test(`Mention a partner with special character (e.g. apostrophe ')`, async name: "Pynya's spokesman", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); @@ -1258,7 +1258,7 @@ QUnit.test('mention 2 different partners that have the same name', async functio }, ); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); @@ -1311,7 +1311,7 @@ QUnit.test('mention a channel with space in the name', async function (assert) { name: "General good boy", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -1356,7 +1356,7 @@ QUnit.test('mention a channel with "&" in the name', async function (assert) { name: "General & good", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -1401,7 +1401,7 @@ QUnit.test('mention a channel on a second line when the first line contains #', name: "General good", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -1446,7 +1446,7 @@ QUnit.test('mention a channel when replacing the space after the mention by anot name: "General good", }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 7, model: 'mail.channel', }); @@ -1507,7 +1507,7 @@ QUnit.test('mention 2 different channels that have the same name', async functio }, ); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 11, model: 'mail.channel', }); @@ -1771,7 +1771,7 @@ QUnit.test('first unseen message should be directly preceded by the new message uuid: 'channel20uuid', }]; const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -1826,7 +1826,7 @@ QUnit.test('composer should be focused automatically after clicking on the send this.data['mail.channel'].records.push({ id: 20 }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -1865,7 +1865,7 @@ QUnit.test('failure on loading messages should display error', async function (a return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -1900,7 +1900,7 @@ QUnit.test('failure on loading messages should prompt retry button', async funct return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -1949,7 +1949,7 @@ QUnit.test('failure on loading more messages should not alter message list displ return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -2001,7 +2001,7 @@ QUnit.test('failure on loading more messages should display error and prompt ret return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -2062,7 +2062,7 @@ QUnit.test('Retry loading more messages on failed load more messages should load return this._super(...arguments); }, }); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -2113,7 +2113,7 @@ QUnit.test("highlight the message mentioning the current user inside the channel res_id: 20, }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); @@ -2154,7 +2154,7 @@ QUnit.test("not highlighting the message if not mentioning the current user insi res_id: 20, }); const { createThreadViewComponent } = await this.start(); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: 20, model: 'mail.channel' }); diff --git a/addons/mail/static/src/models/activity/activity.js b/addons/mail/static/src/models/activity/activity.js index 36334f00735..8fbf777a08f 100644 --- a/addons/mail/static/src/models/activity/activity.js +++ b/addons/mail/static/src/models/activity/activity.js @@ -287,7 +287,7 @@ registerModel({ * Determines to which "thread" (using `mail.activity.mixin` on the * server) `this` belongs to. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { inverse: 'activities', }), type: many2one('ActivityType', { diff --git a/addons/mail/static/src/models/attachment/attachment.js b/addons/mail/static/src/models/attachment/attachment.js index 947061f769e..4daa8346bcc 100644 --- a/addons/mail/static/src/models/attachment/attachment.js +++ b/addons/mail/static/src/models/attachment/attachment.js @@ -398,11 +398,11 @@ registerModel({ default: '', }), name: attr(), - originThread: many2one('mail.thread', { + originThread: many2one('Thread', { inverse: 'originThreadAttachments', }), size: attr(), - threads: many2many('mail.thread', { + threads: many2many('Thread', { inverse: 'attachments', }), type: attr(), diff --git a/addons/mail/static/src/models/canned_response/canned_response.js b/addons/mail/static/src/models/canned_response/canned_response.js index ad1c2287b11..e8a937161ef 100644 --- a/addons/mail/static/src/models/canned_response/canned_response.js +++ b/addons/mail/static/src/models/canned_response/canned_response.js @@ -17,7 +17,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread */ fetchSuggestions(searchTerm, { thread } = {}) {}, @@ -27,7 +27,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize result in the + * @param {Thread} [options.thread] prioritize result in the * context of given thread * @returns {function} */ @@ -57,7 +57,7 @@ registerModel({ * @static * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread * @returns {[mail.canned_response[], mail.canned_response[]]} */ diff --git a/addons/mail/static/src/models/channel_command/channel_command.js b/addons/mail/static/src/models/channel_command/channel_command.js index 3eb88e6f2fb..29ab36e84d4 100644 --- a/addons/mail/static/src/models/channel_command/channel_command.js +++ b/addons/mail/static/src/models/channel_command/channel_command.js @@ -17,7 +17,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread */ fetchSuggestions(searchTerm, { thread } = {}) {}, @@ -27,7 +27,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize result in the + * @param {Thread} [options.thread] prioritize result in the * context of given thread * @returns {function} */ @@ -64,7 +64,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread * @returns {[ChannelCommand[], ChannelCommand[]]} */ @@ -90,7 +90,7 @@ registerModel({ * Executes this command on the given `mail.channel`. * * @param {Object} param0 - * @param {mail.thread} param0.channel + * @param {Thread} param0.channel * @param {Object} [param0.body=''] */ async execute({ channel, body = '' }) { diff --git a/addons/mail/static/src/models/channel_invitation_form/channel_invitation_form.js b/addons/mail/static/src/models/channel_invitation_form/channel_invitation_form.js index 122b28b9492..b2975695c9c 100644 --- a/addons/mail/static/src/models/channel_invitation_form/channel_invitation_form.js +++ b/addons/mail/static/src/models/channel_invitation_form/channel_invitation_form.js @@ -28,7 +28,7 @@ registerModel({ ...this.thread.members.map(member => member.id), ...this.selectedPartners.map(partner => partner.id), ])]; - const channel = await this.messaging.models['mail.thread'].createGroupChat({ partners_to }); + const channel = await this.messaging.models['Thread'].createGroupChat({ partners_to }); if (this.thread.rtc) { /** * if we were in a RTC call on the current thread, we move to the new group chat. @@ -243,7 +243,7 @@ registerModel({ /** * States the thread on which this list operates (if any). */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { compute: '_computeThread', readonly: true, required: true, diff --git a/addons/mail/static/src/models/chat_window/chat_window.js b/addons/mail/static/src/models/chat_window/chat_window.js index b7815114514..583e3f0fb10 100644 --- a/addons/mail/static/src/models/chat_window/chat_window.js +++ b/addons/mail/static/src/models/chat_window/chat_window.js @@ -460,10 +460,10 @@ registerModel({ compute: '_computeName', }), /** - * Determines the `mail.thread` that should be displayed by `this`. - * If no `mail.thread` is linked, `this` is considered "new message". + * Determines the `Thread` that should be displayed by `this`. + * If no `Thread` is linked, `this` is considered "new message". */ - thread: one2one('mail.thread', { + thread: one2one('Thread', { inverse: 'chatWindow', readonly: true, }), diff --git a/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js b/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js index c3983697da1..53e10957117 100644 --- a/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js +++ b/addons/mail/static/src/models/chat_window_manager/chat_window_manager.js @@ -66,7 +66,7 @@ registerModel({ /** * Closes all chat windows related to the given thread. * - * @param {mail.thread} thread + * @param {Thread} thread * @param {Object} [options] */ closeThread(thread, options) { @@ -86,7 +86,7 @@ registerModel({ this.newMessageChatWindow.makeActive(); }, /** - * @param {mail.thread} thread + * @param {Thread} thread * @param {Object} [param1={}] * @param {boolean} [param1.focus] if set, set focus the chat window * to open. diff --git a/addons/mail/static/src/models/chatter/chatter.js b/addons/mail/static/src/models/chatter/chatter.js index 644ab79b8f2..faa01c35866 100644 --- a/addons/mail/static/src/models/chatter/chatter.js +++ b/addons/mail/static/src/models/chatter/chatter.js @@ -372,9 +372,9 @@ registerModel({ default: false, }), /** - * Determines the `mail.thread` that should be displayed by `this`. + * Determines the `Thread` that should be displayed by `this`. */ - thread: many2one('mail.thread'), + thread: many2one('Thread'), /** * Determines the id of the thread that will be displayed by `this`. */ diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index 86863358d92..28c20c4b88e 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -10,7 +10,7 @@ registerModel({ recordMethods: { /** * @private - * @returns {mail.thread} + * @returns {Thread} */ _computeActiveThread() { if (this.messageViewInEditing && this.messageViewInEditing.message && this.messageViewInEditing.message.originThread) { @@ -120,7 +120,7 @@ registerModel({ }, }, fields: { - activeThread: many2one('mail.thread', { + activeThread: many2one('Thread', { compute: '_computeActiveThread', readonly: true, required: true, @@ -166,7 +166,7 @@ registerModel({ * Determines whether a post_message request is currently pending. */ isPostingMessage: attr(), - mentionedChannels: many2many('mail.thread', { + mentionedChannels: many2many('Thread', { compute: '_computeMentionedChannels', }), mentionedPartners: many2many('mail.partner', { @@ -199,7 +199,7 @@ registerModel({ /** * States the thread which this composer represents the state (if any). */ - thread: one2one('mail.thread', { + thread: one2one('Thread', { inverse: 'composer', readonly: true, }), diff --git a/addons/mail/static/src/models/composer_view/composer_view.js b/addons/mail/static/src/models/composer_view/composer_view.js index 21d0275f926..84db7455b5e 100644 --- a/addons/mail/static/src/models/composer_view/composer_view.js +++ b/addons/mail/static/src/models/composer_view/composer_view.js @@ -142,7 +142,7 @@ registerModel({ // the mention will appear in the target channel, or be notified to // the target partner. switch (this.activeSuggestedRecord.constructor.name) { - case 'mail.thread': + case 'Thread': Object.assign(updateData, { mentionedChannels: link(this.activeSuggestedRecord) }); break; case 'mail.partner': @@ -576,7 +576,7 @@ registerModel({ case '/': return 'ChannelCommand'; case '#': - return 'mail.thread'; + return 'Thread'; default: return clear(); } diff --git a/addons/mail/static/src/models/discuss/discuss.js b/addons/mail/static/src/models/discuss/discuss.js index c822b8010e7..f808b83d1d9 100644 --- a/addons/mail/static/src/models/discuss/discuss.js +++ b/addons/mail/static/src/models/discuss/discuss.js @@ -43,14 +43,14 @@ registerModel({ this.clearIsAddingItem(); if (ui.item.special) { const channel = await this.async(() => - this.messaging.models['mail.thread'].performRpcCreateChannel({ + this.messaging.models['Thread'].performRpcCreateChannel({ name, privacy: ui.item.special, }) ); channel.open(); } else { - const channel = this.messaging.models['mail.thread'].insert({ + const channel = this.messaging.models['Thread'].insert({ id: ui.item.id, model: 'mail.channel', }); @@ -68,7 +68,7 @@ registerModel({ */ async handleAddChannelAutocompleteSource(req, res) { this.update({ addingChannelValue: req.term }); - const threads = await this.messaging.models['mail.thread'].searchChannelsToOpen({ limit: 10, searchTerm: req.term }); + const threads = await this.messaging.models['Thread'].searchChannelsToOpen({ limit: 10, searchTerm: req.term }); const items = threads.map((thread) => { const escapedName = owl.utils.escape(thread.name); return { @@ -151,7 +151,7 @@ registerModel({ * @param {MouseEvent} ev */ async onClickStartAMeetingButton(ev) { - const meetingChannel = await this.messaging.models['mail.thread'].createGroupChat({ + const meetingChannel = await this.messaging.models['Thread'].createGroupChat({ default_display_mode: 'video_full_screen', partners_to: [this.messaging.currentPartner.id], }); @@ -171,7 +171,7 @@ registerModel({ const [model, id] = typeof this.initActiveId === 'number' ? ['mail.channel', this.initActiveId] : this.initActiveId.split('_'); - const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const thread = this.messaging.models['Thread'].findFromIdentifyingData({ id: model !== 'mail.box' ? Number(id) : id, model, }); @@ -186,7 +186,7 @@ registerModel({ /** * Opens the given thread in Discuss, and opens Discuss if necessary. * - * @param {mail.thread} thread + * @param {Thread} thread * @param {Object} [param1={}] * @param {Boolean} [param1.focus] */ @@ -209,7 +209,7 @@ registerModel({ } }, /** - * @param {mail.thread} thread + * @param {Thread} thread * @returns {string} */ threadToActiveId(thread) { @@ -289,7 +289,7 @@ registerModel({ * Only pinned threads are allowed in discuss. * * @private - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ _computeThread() { if (!this.thread || !this.thread.isPinned) { @@ -400,9 +400,9 @@ registerModel({ */ startAMeetingButtonRef: attr(), /** - * Determines the `mail.thread` that should be displayed by `this`. + * Determines the `Thread` that should be displayed by `this`. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { compute: '_computeThread', }), /** diff --git a/addons/mail/static/src/models/discuss_public_view/discuss_public_view.js b/addons/mail/static/src/models/discuss_public_view/discuss_public_view.js index 545558838e1..64b7fe6a094 100644 --- a/addons/mail/static/src/models/discuss_public_view/discuss_public_view.js +++ b/addons/mail/static/src/models/discuss_public_view/discuss_public_view.js @@ -54,7 +54,7 @@ registerModel({ /** * States the channel linked to this discuss public view. */ - channel: one2one('mail.thread', { + channel: one2one('Thread', { readonly: true, required: true, }), diff --git a/addons/mail/static/src/models/discuss_sidebar_category_item/discuss_sidebar_category_item.js b/addons/mail/static/src/models/discuss_sidebar_category_item/discuss_sidebar_category_item.js index 85d02d7478d..92d0e1dc82b 100644 --- a/addons/mail/static/src/models/discuss_sidebar_category_item/discuss_sidebar_category_item.js +++ b/addons/mail/static/src/models/discuss_sidebar_category_item/discuss_sidebar_category_item.js @@ -275,7 +275,7 @@ registerModel({ /** * The related channel thread. */ - channel: one2one('mail.thread', { + channel: one2one('Thread', { inverse: 'discussSidebarCategoryItem', readonly: true, required: true, diff --git a/addons/mail/static/src/models/follower/follower.js b/addons/mail/static/src/models/follower/follower.js index 13b7e713f6c..b7e2917eed1 100644 --- a/addons/mail/static/src/models/follower/follower.js +++ b/addons/mail/static/src/models/follower/follower.js @@ -142,7 +142,7 @@ registerModel({ }, }, fields: { - followedThread: many2one('mail.thread', { + followedThread: many2one('Thread', { inverse: 'followers', }), id: attr({ diff --git a/addons/mail/static/src/models/message/message.js b/addons/mail/static/src/models/message/message.js index 553fca45c9a..579e1016f49 100644 --- a/addons/mail/static/src/models/message/message.js +++ b/addons/mail/static/src/models/message/message.js @@ -512,7 +512,7 @@ registerModel({ }, /** * @private - * @returns {mail.thread[]} + * @returns {Thread[]} */ _computeThreads() { const threads = []; @@ -716,7 +716,7 @@ registerModel({ /** * Origin thread of this message (if any). */ - originThread: many2one('mail.thread', { + originThread: many2one('Thread', { inverse: 'messagesAsOriginThread', }), /** @@ -742,7 +742,7 @@ registerModel({ /** * All threads that this message is linked to. This field is read-only. */ - threads: many2many('mail.thread', { + threads: many2many('Thread', { compute: '_computeThreads', inverse: 'messages', }), diff --git a/addons/mail/static/src/models/message/tests/message_tests.js b/addons/mail/static/src/models/message/tests/message_tests.js index 5dcbf0503fb..294b5760201 100644 --- a/addons/mail/static/src/models/message/tests/message_tests.js +++ b/addons/mail/static/src/models/message/tests/message_tests.js @@ -30,14 +30,14 @@ QUnit.test('create', async function (assert) { await this.start(); assert.notOk(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 5 })); - assert.notOk(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.notOk(this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); assert.notOk(this.messaging.models['mail.attachment'].findFromIdentifyingData({ id: 750 })); assert.notOk(this.messaging.models['mail.message'].findFromIdentifyingData({ id: 4000 })); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ id: 100, model: 'mail.channel', name: "General", @@ -59,7 +59,7 @@ QUnit.test('create', async function (assert) { }); assert.ok(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 5 })); - assert.ok(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.ok(this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); @@ -75,12 +75,12 @@ QUnit.test('create', async function (assert) { "2019-05-05 10:00:00" ); assert.strictEqual(message.id, 4000); - assert.strictEqual(message.originThread, this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.strictEqual(message.originThread, this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); assert.ok( - message.threads.includes(this.messaging.models['mail.thread'].findFromIdentifyingData({ + message.threads.includes(this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })) @@ -96,7 +96,7 @@ QUnit.test('create', async function (assert) { assert.notOk(attachment.isUploading); assert.strictEqual(attachment.mimetype, 'text/plain'); assert.strictEqual(attachment.name, "test.txt"); - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', }); diff --git a/addons/mail/static/src/models/message_seen_indicator/message_seen_indicator.js b/addons/mail/static/src/models/message_seen_indicator/message_seen_indicator.js index e06b78251f5..0500203d854 100644 --- a/addons/mail/static/src/models/message_seen_indicator/message_seen_indicator.js +++ b/addons/mail/static/src/models/message_seen_indicator/message_seen_indicator.js @@ -9,7 +9,7 @@ registerModel({ identifyingFields: ['thread', 'message'], modelMethods: { /** - * @param {mail.thread} [channel] the concerned thread + * @param {Thread} [channel] the concerned thread */ recomputeFetchedValues(channel = undefined) { const indicatorFindFunction = channel ? localIndicator => localIndicator.thread === channel : undefined; @@ -23,7 +23,7 @@ registerModel({ } }, /** - * @param {mail.thread} [channel] the concerned thread + * @param {Thread} [channel] the concerned thread */ recomputeSeenValues(channel = undefined) { const indicatorFindFunction = channel ? localIndicator => localIndicator.thread === channel : undefined; @@ -239,7 +239,7 @@ registerModel({ /** * The thread concerned by this seen indicator. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { inverse: 'messageSeenIndicators', readonly: true, required: true, diff --git a/addons/mail/static/src/models/messaging/messaging.js b/addons/mail/static/src/models/messaging/messaging.js index 92e98a09308..3eae0ae0169 100644 --- a/addons/mail/static/src/models/messaging/messaging.js +++ b/addons/mail/static/src/models/messaging/messaging.js @@ -45,7 +45,7 @@ registerModel({ * @param {integer} [param0.partnerId] * @param {integer} [param0.userId] * @param {Object} [options] - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ async getChat({ partnerId, userId }) { if (userId) { @@ -63,8 +63,8 @@ registerModel({ * If a chat is not appropriate, a notification is displayed instead. * * @param {Object} person forwarded to @see `getChat()` - * @param {Object} [options] forwarded to @see `mail.thread:open()` - * @returns {mail.thread|undefined} + * @param {Object} [options] forwarded to @see `Thread:open()` + * @returns {Thread|undefined} */ async openChat(person, options) { const chat = await this.async(() => this.getChat(person)); @@ -114,10 +114,10 @@ registerModel({ return user.openProfile(); } if (model === 'mail.channel') { - let channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ id, model: 'mail.channel' }); + let channel = this.messaging.models['Thread'].findFromIdentifyingData({ id, model: 'mail.channel' }); if (!channel) { channel = (await this.async(() => - this.messaging.models['mail.thread'].performRpcChannelInfo({ ids: [id] }) + this.messaging.models['Thread'].performRpcChannelInfo({ ids: [id] }) ))[0]; } if (!channel) { @@ -268,11 +268,11 @@ registerModel({ /** * Mailbox History. */ - history: one2one('mail.thread'), + history: one2one('Thread'), /** * Mailbox Inbox. */ - inbox: one2one('mail.thread'), + inbox: one2one('Thread'), /** * Promise that will be resolved when messaging is initialized. */ @@ -351,7 +351,7 @@ registerModel({ * Threads for which the current partner has a pending invitation. * It is computed from the inverse relation for performance reasons. */ - ringingThreads: one2many('mail.thread', { + ringingThreads: one2many('Thread', { inverse: 'messagingAsRingingThread', }), rtc: one2one('Rtc', { @@ -367,7 +367,7 @@ registerModel({ /** * Mailbox Starred. */ - starred: one2one('mail.thread'), + starred: one2one('Thread'), userSetting: one2one('mail.user_setting', { isCausal: true, }), diff --git a/addons/mail/static/src/models/messaging/tests/messaging_tests.js b/addons/mail/static/src/models/messaging/tests/messaging_tests.js index eb30469a1bc..129c49c3458 100644 --- a/addons/mail/static/src/models/messaging/tests/messaging_tests.js +++ b/addons/mail/static/src/models/messaging/tests/messaging_tests.js @@ -79,7 +79,7 @@ QUnit.test('openChat: open new chat for user', async function (assert) { this.data['res.users'].records.push({ id: 11, partner_id: 14 }); await this.start(); - const existingChat = this.messaging.models['mail.thread'].find(thread => + const existingChat = this.messaging.models['Thread'].find(thread => thread.channel_type === 'chat' && thread.correspondent && thread.correspondent.id === 14 && @@ -89,7 +89,7 @@ QUnit.test('openChat: open new chat for user', async function (assert) { assert.notOk(existingChat, 'a chat should not exist with the target partner initially'); await this.messaging.openChat({ partnerId: 14 }); - const chat = this.messaging.models['mail.thread'].find(thread => + const chat = this.messaging.models['Thread'].find(thread => thread.channel_type === 'chat' && thread.correspondent && thread.correspondent.id === 14 && @@ -112,7 +112,7 @@ QUnit.test('openChat: open existing chat for user', async function (assert) { public: 'private', }); await this.start(); - const existingChat = this.messaging.models['mail.thread'].find(thread => + const existingChat = this.messaging.models['Thread'].find(thread => thread.channel_type === 'chat' && thread.correspondent && thread.correspondent.id === 14 && diff --git a/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js b/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js index 173939803e5..804ae1d4fdb 100644 --- a/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js +++ b/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js @@ -132,7 +132,7 @@ registerModel({ */ async _initChannels(channelsData) { return executeGracefully(channelsData.map(channelData => () => { - const convertedData = this.messaging.models['mail.thread'].convertData(channelData); + const convertedData = this.messaging.models['Thread'].convertData(channelData); if (!convertedData.members) { // channel_info does not return all members of channel for // performance reasons, but code is expecting to know at @@ -147,7 +147,7 @@ registerModel({ convertedData.guestMembers = link(this.messaging.currentGuest); } } - const channel = this.messaging.models['mail.thread'].insert( + const channel = this.messaging.models['Thread'].insert( Object.assign({ model: 'mail.channel' }, convertedData) ); // flux specific: channels received at init have to be diff --git a/addons/mail/static/src/models/messaging_menu/messaging_menu.js b/addons/mail/static/src/models/messaging_menu/messaging_menu.js index 99396eb68f9..865ff9642c2 100644 --- a/addons/mail/static/src/models/messaging_menu/messaging_menu.js +++ b/addons/mail/static/src/models/messaging_menu/messaging_menu.js @@ -80,7 +80,7 @@ registerModel({ /** * States all the pinned channels that have unread messages. */ - pinnedAndUnreadChannels: one2many('mail.thread', { + pinnedAndUnreadChannels: one2many('Thread', { inverse: 'messagingMenuAsPinnedAndUnreadChannel', readonly: true, }), diff --git a/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js b/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js index 252f874d77c..4a1e44c2bb8 100644 --- a/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js +++ b/addons/mail/static/src/models/messaging_menu/tests/messaging_menu_tests.js @@ -23,7 +23,7 @@ QUnit.test('messaging menu counter should ignore unread messages in channels tha assert.expect(1); await this.start(); - this.messaging.models['mail.thread'].create({ + this.messaging.models['Thread'].create({ id: 31, isServerPinned: false, model: 'mail.channel', diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js index c3f753e0aa1..6bc38d64618 100644 --- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js +++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js @@ -98,7 +98,7 @@ registerModel({ case 'mail.channel/last_interest_dt_changed': return this._handleNotificationChannelLastInterestDateTimeChanged(message.payload); case 'mail.channel/legacy_insert': - return this.messaging.models['mail.thread'].insert(this.messaging.models['mail.thread'].convertData({ model: 'mail.channel', ...message.payload })); + return this.messaging.models['Thread'].insert(this.messaging.models['Thread'].convertData({ model: 'mail.channel', ...message.payload })); case 'mail.channel/insert': return this._handleNotificationChannelUpdate(message.payload); case 'mail.guest/insert': @@ -153,7 +153,7 @@ registerModel({ last_message_id, partner_id, }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: channelId, model: 'mail.channel', }); @@ -181,11 +181,11 @@ registerModel({ /** * @private * @param {Object} payload - * @param {mail.thread} payload.channel + * @param {Thread} payload.channel * @param {integer} payload.invited_by_user_id */ _handleNotificationChannelJoined({ channel: channelData, invited_by_user_id: invitedByUserId }) { - const channel = this.messaging.models['mail.thread'].insert(this.messaging.models['mail.thread'].convertData(channelData)); + const channel = this.messaging.models['Thread'].insert(this.messaging.models['Thread'].convertData(channelData)); if (invitedByUserId !== this.messaging.currentUser.id) { // Current user was invited by someone else. this.env.services['notification'].notify({ @@ -204,7 +204,7 @@ registerModel({ * @param {string} payload.last_interest_dt */ _handleNotificationChannelLastInterestDateTimeChanged({ id, last_interest_dt }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: id, model: 'mail.channel', }); @@ -221,7 +221,7 @@ registerModel({ * @param {Object} payload.messageData */ async _handleNotificationChannelMessage({ id: channelId, message: messageData }) { - let channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + let channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: channelId, model: 'mail.channel', }); @@ -237,7 +237,7 @@ registerModel({ // features such as chat windows. if (!channel) { channel = (await this.async(() => - this.messaging.models['mail.thread'].performRpcChannelInfo({ ids: [channelId] }) + this.messaging.models['Thread'].performRpcChannelInfo({ ids: [channelId] }) ))[0]; } if (!channel.isPinned) { @@ -293,7 +293,7 @@ registerModel({ last_message_id, partner_id, }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: channelId, model: 'mail.channel', }); @@ -325,7 +325,7 @@ registerModel({ } if (shouldComputeSeenIndicators) { // FIXME force the computing of thread values (cf task-2261221) - this.messaging.models['mail.thread'].computeLastCurrentPartnerMessageSeenByEveryone(channel); + this.messaging.models['Thread'].computeLastCurrentPartnerMessageSeenByEveryone(channel); // FIXME force the computing of message values (cf task-2261221) this.messaging.models['MessageSeenIndicator'].recomputeSeenValues(channel); } @@ -339,7 +339,7 @@ registerModel({ * @param {string} param1.partner_name */ _handleNotificationChannelPartnerTypingStatus({ channel_id, is_typing, partner_id, partner_name }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: channel_id, model: 'mail.channel', }); @@ -374,7 +374,7 @@ registerModel({ * @param {Object} channelData */ _handleNotificationChannelUpdate(channelData) { - this.messaging.models['mail.thread'].insert({ model: 'mail.channel', ...channelData }); + this.messaging.models['Thread'].insert({ model: 'mail.channel', ...channelData }); }, /** * @private @@ -477,7 +477,7 @@ registerModel({ * @param {Object} [data.rtcSessions] */ async _handleNotificationRtcSessionUpdate({ id, rtcSessions }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ id, model: 'mail.channel' }); + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id, model: 'mail.channel' }); if (!channel) { return; } @@ -603,7 +603,7 @@ registerModel({ * @param {integer} payload.id */ _handleNotificationChannelLeave({ id }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id, model: 'mail.channel', }); @@ -625,7 +625,7 @@ registerModel({ * @param {integer} payload.id */ _handleNotificationChannelUnpin({ id }) { - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id, model: 'mail.channel', }); @@ -663,7 +663,7 @@ registerModel({ /** * @private * @param {Object} param0 - * @param {mail.thread} param0.channel + * @param {Thread} param0.channel * @param {mail.message} param0.message */ _notifyNewChannelMessageWhileOutOfFocus({ channel, message }) { diff --git a/addons/mail/static/src/models/notification_group/notification_group.js b/addons/mail/static/src/models/notification_group/notification_group.js index 34e9735b88b..c05be1e4bbe 100644 --- a/addons/mail/static/src/models/notification_group/notification_group.js +++ b/addons/mail/static/src/models/notification_group/notification_group.js @@ -39,7 +39,7 @@ registerModel({ }, /** * @private - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ _computeThread() { const notificationsThreadIds = this.notifications @@ -144,7 +144,7 @@ registerModel({ /** * Related thread when the notification group concerns a single thread. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { compute: '_computeThread', }), }, diff --git a/addons/mail/static/src/models/partner/partner.js b/addons/mail/static/src/models/partner/partner.js index 904cafd663a..c46bbb9ac70 100644 --- a/addons/mail/static/src/models/partner/partner.js +++ b/addons/mail/static/src/models/partner/partner.js @@ -76,7 +76,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread */ async fetchSuggestions(searchTerm, { thread } = {}) { @@ -106,7 +106,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize result in the + * @param {Thread} [options.thread] prioritize result in the * context of given thread * @returns {function} */ @@ -218,7 +218,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread * @returns {[mail.partner[], mail.partner[]]} */ @@ -320,7 +320,7 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ async getChat() { if (!this.user && !this.hasCheckedUser) { @@ -350,8 +350,8 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @param {Object} [options] forwarded to @see `mail.thread:open()` - * @returns {mail.thread|undefined} + * @param {Object} [options] forwarded to @see `Thread:open()` + * @returns {Thread|undefined} */ async openChat(options) { const chat = await this.async(() => this.getChat()); @@ -436,7 +436,7 @@ registerModel({ isMuted: attr({ default: false, }), - memberThreads: many2many('mail.thread', { + memberThreads: many2many('Thread', { inverse: 'members', }), model: attr({ diff --git a/addons/mail/static/src/models/rtc/rtc.js b/addons/mail/static/src/models/rtc/rtc.js index 251ce192825..da5a448392d 100644 --- a/addons/mail/static/src/models/rtc/rtc.js +++ b/addons/mail/static/src/models/rtc/rtc.js @@ -1164,7 +1164,7 @@ registerModel({ /** * The channel that is hosting the current RTC call. */ - channel: one2one('mail.thread', { + channel: one2one('Thread', { inverse: 'rtc', }), /** diff --git a/addons/mail/static/src/models/rtc_call_participant_card/rtc_call_participant_card.js b/addons/mail/static/src/models/rtc_call_participant_card/rtc_call_participant_card.js index b250d14a135..849a2beb40d 100644 --- a/addons/mail/static/src/models/rtc_call_participant_card/rtc_call_participant_card.js +++ b/addons/mail/static/src/models/rtc_call_participant_card/rtc_call_participant_card.js @@ -122,7 +122,7 @@ registerModel({ /** * The channel of the call. */ - channel: many2one('mail.thread', { + channel: many2one('Thread', { required: true, }), /** diff --git a/addons/mail/static/src/models/rtc_session/rtc_session.js b/addons/mail/static/src/models/rtc_session/rtc_session.js index 548279a395f..3aae2afee37 100644 --- a/addons/mail/static/src/models/rtc_session/rtc_session.js +++ b/addons/mail/static/src/models/rtc_session/rtc_session.js @@ -299,7 +299,7 @@ registerModel({ * The mail.channel of the session, rtc sessions are part and managed by * mail.channel */ - channel: many2one('mail.thread', { + channel: many2one('Thread', { inverse: 'rtcSessions', }), /** @@ -324,7 +324,7 @@ registerModel({ * this serves as an explicit inverse as it seems to confuse it with * other session-channel relations otherwise. */ - calledChannels: one2many('mail.thread', { + calledChannels: one2many('Thread', { inverse: 'rtcInvitingSession', }), /** diff --git a/addons/mail/static/src/models/suggested_recipient_info/suggested_recipient_info.js b/addons/mail/static/src/models/suggested_recipient_info/suggested_recipient_info.js index fb9c0bea1f1..b01e15e089f 100644 --- a/addons/mail/static/src/models/suggested_recipient_info/suggested_recipient_info.js +++ b/addons/mail/static/src/models/suggested_recipient_info/suggested_recipient_info.js @@ -72,9 +72,9 @@ registerModel({ */ reason: attr(), /** - * Determines the `mail.thread` concerned by `this.` + * Determines the `Thread` concerned by `this.` */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { inverse: 'suggestedRecipientInfoList', required: true, }), diff --git a/addons/mail/static/src/models/thread/tests/thread_tests.js b/addons/mail/static/src/models/thread/tests/thread_tests.js index 909700b35a8..8f97f39c85f 100644 --- a/addons/mail/static/src/models/thread/tests/thread_tests.js +++ b/addons/mail/static/src/models/thread/tests/thread_tests.js @@ -47,12 +47,12 @@ QUnit.test('create (channel)', async function (assert) { await this.start(); assert.notOk(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 9 })); assert.notOk(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 10 })); - assert.notOk(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.notOk(this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); - const thread = this.messaging.models['mail.thread'].create({ + const thread = this.messaging.models['Thread'].create({ channel_type: 'channel', id: 100, members: insert([{ @@ -73,13 +73,13 @@ QUnit.test('create (channel)', async function (assert) { assert.ok(thread); assert.ok(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 9 })); assert.ok(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 10 })); - assert.ok(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.ok(this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); const partner9 = this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 9 }); const partner10 = this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 10 }); - assert.strictEqual(thread, this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.strictEqual(thread, this.messaging.models['Thread'].findFromIdentifyingData({ id: 100, model: 'mail.channel', })); @@ -105,12 +105,12 @@ QUnit.test('create (chat)', async function (assert) { await this.start(); assert.notOk(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 5 })); - assert.notOk(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.notOk(this.messaging.models['Thread'].findFromIdentifyingData({ id: 200, model: 'mail.channel', })); - const channel = this.messaging.models['mail.thread'].create({ + const channel = this.messaging.models['Thread'].create({ channel_type: 'chat', id: 200, members: insert({ @@ -122,13 +122,13 @@ QUnit.test('create (chat)', async function (assert) { model: 'mail.channel', }); assert.ok(channel); - assert.ok(this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.ok(this.messaging.models['Thread'].findFromIdentifyingData({ id: 200, model: 'mail.channel', })); assert.ok(this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 5 })); const partner = this.messaging.models['mail.partner'].findFromIdentifyingData({ id: 5 }); - assert.strictEqual(channel, this.messaging.models['mail.thread'].findFromIdentifyingData({ + assert.strictEqual(channel, this.messaging.models['Thread'].findFromIdentifyingData({ id: 200, model: 'mail.channel', })); diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index fa03b72429d..8f9edf3f534 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -20,7 +20,7 @@ const getSuggestedRecipientInfoNextTemporaryId = (function () { })(); registerModel({ - name: 'mail.thread', + name: 'Thread', identifyingFields: ['model', 'id'], lifecycleHooks: { _willCreate() { @@ -127,10 +127,10 @@ registerModel({ }, modelMethods: { /** - * @param {mail.thread} [thread] the concerned thread + * @param {Thread} [thread] the concerned thread */ computeLastCurrentPartnerMessageSeenByEveryone(thread = undefined) { - const threads = thread ? [thread] : this.messaging.models['mail.thread'].all(); + const threads = thread ? [thread] : this.messaging.models['Thread'].all(); threads.map(localThread => { localThread.update({ lastCurrentPartnerMessageSeenByEveryone: localThread._computeLastCurrentPartnerMessageSeenByEveryone(), @@ -285,7 +285,7 @@ registerModel({ * @param {number[]} param0.partners_to Ids of the partners to add as channel * members. * @param {boolean|string} param0.default_display_mode - * @returns {mail.thread} The newly created group chat. + * @returns {Thread} The newly created group chat. */ async createGroupChat({ default_display_mode, partners_to }) { const channelData = await this.env.services.rpc({ @@ -296,8 +296,8 @@ registerModel({ partners_to, }, }); - return this.messaging.models['mail.thread'].insert( - this.messaging.models['mail.thread'].convertData(channelData) + return this.messaging.models['Thread'].insert( + this.messaging.models['Thread'].convertData(channelData) ); }, /** @@ -307,7 +307,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread */ async fetchSuggestions(searchTerm, { thread } = {}) { @@ -319,10 +319,10 @@ registerModel({ }, { shadow: true }, ); - this.messaging.models['mail.thread'].insert(channelsData.map(channelData => + this.messaging.models['Thread'].insert(channelsData.map(channelData => Object.assign( { model: 'mail.channel' }, - this.messaging.models['mail.thread'].convertData(channelData), + this.messaging.models['Thread'].convertData(channelData), ) )); }, @@ -332,7 +332,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize result in the + * @param {Thread} [options.thread] prioritize result in the * context of given thread * @returns {function} */ @@ -376,7 +376,7 @@ registerModel({ * Load the previews of the specified threads. Basically, it fetches the * last messages, since they are used to display inline content of them. * - * @param {mail.thread[]} threads + * @param {Thread[]} threads */ async loadPreviews(threads) { const channelIds = threads.reduce((list, thread) => { @@ -418,7 +418,7 @@ registerModel({ * * @param {Object} param0 * @param {integer[]} param0.ids list of id of channels - * @returns {mail.thread[]} + * @returns {Thread[]} */ async performRpcChannelInfo({ ids }) { const channelInfos = await this.env.services.rpc({ @@ -426,8 +426,8 @@ registerModel({ method: 'channel_info', args: [ids], }, { shadow: true }); - const channels = this.messaging.models['mail.thread'].insert( - channelInfos.map(channelInfo => this.messaging.models['mail.thread'].convertData(channelInfo)) + const channels = this.messaging.models['Thread'].insert( + channelInfos.map(channelInfo => this.messaging.models['Thread'].convertData(channelInfo)) ); return channels; }, @@ -470,7 +470,7 @@ registerModel({ * @param {Object} param0 * @param {string} param0.name * @param {string} [param0.privacy] - * @returns {mail.thread} the created channel + * @returns {Thread} the created channel */ async performRpcCreateChannel({ name, privacy }) { const device = this.messaging.device; @@ -486,8 +486,8 @@ registerModel({ }), }, }); - return this.messaging.models['mail.thread'].insert( - this.messaging.models['mail.thread'].convertData(data) + return this.messaging.models['Thread'].insert( + this.messaging.models['Thread'].convertData(data) ); }, /** @@ -499,7 +499,7 @@ registerModel({ * @param {Object} param0 * @param {integer[]} param0.partnerIds * @param {boolean} [param0.pinForCurrentPartner] - * @returns {mail.thread|undefined} the created or existing chat + * @returns {Thread|undefined} the created or existing chat */ async performRpcCreateChat({ partnerIds, pinForCurrentPartner }) { const device = this.messaging.device; @@ -520,8 +520,8 @@ registerModel({ if (!data) { return; } - return this.messaging.models['mail.thread'].insert( - this.messaging.models['mail.thread'].convertData(data) + return this.messaging.models['Thread'].insert( + this.messaging.models['Thread'].convertData(data) ); }, /** @@ -593,7 +593,7 @@ registerModel({ * * @param {string} searchTerm * @param {Object} [options={}] - * @param {mail.thread} [options.thread] prioritize and/or restrict + * @param {Thread} [options.thread] prioritize and/or restrict * result in the context of given thread * @returns {[mail.threads[], mail.threads[]]} */ @@ -607,7 +607,7 @@ registerModel({ // channel. threads = [thread]; } else { - threads = this.messaging.models['mail.thread'].all(); + threads = this.messaging.models['Thread'].all(); } const cleanedSearchTerm = cleanSearchTerm(searchTerm); return [threads.filter(thread => @@ -655,7 +655,7 @@ registerModel({ if (this.isTemporary) { return; } - return this.messaging.models['mail.thread'].performRpcMailGetSuggestedRecipients({ + return this.messaging.models['Thread'].performRpcMailGetSuggestedRecipients({ model: this.model, res_ids: [this.id], }); @@ -859,7 +859,7 @@ registerModel({ return; } this.update({ pendingSeenMessageId: message.id }); - return this.messaging.models['mail.thread'].performRpcChannelSeen({ + return this.messaging.models['Thread'].performRpcChannelSeen({ id: this.id, lastMessageId: message.id, }); @@ -886,7 +886,7 @@ registerModel({ if (!this.uuid) { return; } - return this.messaging.models['mail.thread'].performRpcChannelFold(this.uuid, state); + return this.messaging.models['Thread'].performRpcChannelFold(this.uuid, state); }, /** * Notify server to leave the current channel. Useful for cross-tab @@ -899,7 +899,7 @@ registerModel({ await this.leave(); return; } - await this.messaging.models['mail.thread'].performRpcChannelPin({ + await this.messaging.models['Thread'].performRpcChannelPin({ pinned: this.isPendingPinned, uuid: this.uuid, }); @@ -1829,7 +1829,7 @@ registerModel({ options: { on_close: async () => { await this.async(() => this.refreshFollowers()); - this.env.bus.trigger('mail.thread:promptAddFollower-closed'); + this.env.bus.trigger('Thread:promptAddFollower-closed'); }, }, }); @@ -2184,7 +2184,7 @@ registerModel({ * Determines the last mentioned channels of the last composer related * to this thread. Useful to sync the composer when re-creating it. */ - mentionedChannelsBackup: many2many('mail.thread'), + mentionedChannelsBackup: many2many('Thread'), /** * Determines the last mentioned partners of the last composer related * to this thread. Useful to sync the composer when re-creating it. diff --git a/addons/mail/static/src/models/thread_cache/thread_cache.js b/addons/mail/static/src/models/thread_cache/thread_cache.js index c9530feaa07..18b522cb2af 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -401,7 +401,7 @@ registerModel({ orderedNonEmptyMessages: many2many('mail.message', { compute: '_computeOrderedNonEmptyMessages', }), - thread: one2one('mail.thread', { + thread: one2one('Thread', { inverse: 'cache', readonly: true, required: true, diff --git a/addons/mail/static/src/models/thread_partner_seen_info/thread_partner_seen_info.js b/addons/mail/static/src/models/thread_partner_seen_info/thread_partner_seen_info.js index 53fc3fd2aad..814bcfa9931 100644 --- a/addons/mail/static/src/models/thread_partner_seen_info/thread_partner_seen_info.js +++ b/addons/mail/static/src/models/thread_partner_seen_info/thread_partner_seen_info.js @@ -20,7 +20,7 @@ registerModel({ /** * Thread (channel) that this seen info is related to. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { inverse: 'partnerSeenInfos', readonly: true, required: true, diff --git a/addons/mail/static/src/models/thread_view/thread_view.js b/addons/mail/static/src/models/thread_view/thread_view.js index 3eb6809c699..0d9f8d8531c 100644 --- a/addons/mail/static/src/models/thread_view/thread_view.js +++ b/addons/mail/static/src/models/thread_view/thread_view.js @@ -433,9 +433,9 @@ registerModel({ readonly: true, }), /** - * Determines the `mail.thread` currently displayed by `this`. + * Determines the `Thread` currently displayed by `this`. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { inverse: 'threadViews', readonly: true, related: 'threadViewer.thread', diff --git a/addons/mail/static/src/models/thread_view/thread_viewer.js b/addons/mail/static/src/models/thread_view/thread_viewer.js index 4d4986a2b32..43a2de2f3fb 100644 --- a/addons/mail/static/src/models/thread_view/thread_viewer.js +++ b/addons/mail/static/src/models/thread_view/thread_viewer.js @@ -113,9 +113,9 @@ registerModel({ default: 'asc', }), /** - * Determines the `mail.thread` that should be displayed by `this`. + * Determines the `Thread` that should be displayed by `this`. */ - thread: many2one('mail.thread'), + thread: many2one('Thread'), /** * States the `mail.thread_cache` that should be displayed by `this`. */ diff --git a/addons/mail/static/src/models/thread_view_topbar/thread_view_topbar.js b/addons/mail/static/src/models/thread_view_topbar/thread_view_topbar.js index a888f6ce685..9972f15dff1 100644 --- a/addons/mail/static/src/models/thread_view_topbar/thread_view_topbar.js +++ b/addons/mail/static/src/models/thread_view_topbar/thread_view_topbar.js @@ -658,7 +658,7 @@ registerModel({ /** * States the thread that is displayed by this top bar. */ - thread: many2one('mail.thread', { + thread: many2one('Thread', { related: 'threadView.thread', }), /** diff --git a/addons/mail/static/src/models/user/user.js b/addons/mail/static/src/models/user/user.js index e3e2aea57b8..4a8f604bde2 100644 --- a/addons/mail/static/src/models/user/user.js +++ b/addons/mail/static/src/models/user/user.js @@ -70,7 +70,7 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @returns {mail.thread|undefined} + * @returns {Thread|undefined} */ async getChat() { if (!this.partner) { @@ -88,7 +88,7 @@ registerModel({ return; } // in other cases a chat would be valid, find it or try to create it - let chat = this.messaging.models['mail.thread'].find(thread => + let chat = this.messaging.models['Thread'].find(thread => thread.channel_type === 'chat' && thread.correspondent === this.partner && thread.model === 'mail.channel' && @@ -98,7 +98,7 @@ registerModel({ // if chat is not pinned then it has to be pinned client-side // and server-side, which is a side effect of following rpc chat = await this.async(() => - this.messaging.models['mail.thread'].performRpcCreateChat({ + this.messaging.models['Thread'].performRpcCreateChat({ partnerIds: [this.partner.id], }) ); @@ -117,8 +117,8 @@ registerModel({ * * If a chat is not appropriate, a notification is displayed instead. * - * @param {Object} [options] forwarded to @see `mail.thread:open()` - * @returns {mail.thread|undefined} + * @param {Object} [options] forwarded to @see `Thread:open()` + * @returns {Thread|undefined} */ async openChat(options) { const chat = await this.async(() => this.getChat()); diff --git a/addons/mail/static/src/models/welcome_view/welcome_view.js b/addons/mail/static/src/models/welcome_view/welcome_view.js index f3e002519f3..c67d2a46a0e 100644 --- a/addons/mail/static/src/models/welcome_view/welcome_view.js +++ b/addons/mail/static/src/models/welcome_view/welcome_view.js @@ -136,7 +136,7 @@ registerModel({ * States the channel to redirect to once the user clicks on the * 'joinButton'. */ - channel: one2one('mail.thread', { + channel: one2one('Thread', { readonly: true, required: true, }), diff --git a/addons/mail/static/src/public/discuss_public_boot.js b/addons/mail/static/src/public/discuss_public_boot.js index ce76e68ed68..3c68a8fc7b5 100644 --- a/addons/mail/static/src/public/discuss_public_boot.js +++ b/addons/mail/static/src/public/discuss_public_boot.js @@ -70,7 +70,7 @@ async function createAndMountDiscussPublicView() { const DialogManager = getMessagingComponent('DialogManager'); const dialogManagerComponent = new DialogManager(null, {}); await dialogManagerComponent.mount(document.body); - messaging.models['mail.thread'].insert(messaging.models['mail.thread'].convertData(data.channelData)); + messaging.models['Thread'].insert(messaging.models['Thread'].convertData(data.channelData)); const discussPublicView = messaging.models['DiscussPublicView'].create(data.discussPublicViewData); if (discussPublicView.shouldDisplayWelcomeViewInitially) { discussPublicView.switchToWelcomeView(); diff --git a/addons/mail/static/src/webclient/commands/mail_providers.js b/addons/mail/static/src/webclient/commands/mail_providers.js index 74d4aeae750..6494ce56cb5 100644 --- a/addons/mail/static/src/webclient/commands/mail_providers.js +++ b/addons/mail/static/src/webclient/commands/mail_providers.js @@ -50,7 +50,7 @@ commandProviderRegistry.add("channel", { namespace: "#", async provide(newEnv, options) { const messaging = await Component.env.services.messaging.get(); - const channels = await messaging.models['mail.thread'].searchChannelsToOpen({ + const channels = await messaging.models['Thread'].searchChannelsToOpen({ limit: 10, searchTerm: options.searchValue, }); diff --git a/addons/mail/static/src/widgets/form_renderer/form_renderer.js b/addons/mail/static/src/widgets/form_renderer/form_renderer.js index e08b57286a5..cffe0ad9348 100644 --- a/addons/mail/static/src/widgets/form_renderer/form_renderer.js +++ b/addons/mail/static/src/widgets/form_renderer/form_renderer.js @@ -37,7 +37,7 @@ FormRenderer.include({ this.off('o_attachments_changed', this); this.off('o_chatter_rendered', this); this.off('o_message_posted', this); - owl.Component.env.bus.off('mail.thread:promptAddFollower-closed', this); + owl.Component.env.bus.off('Thread:promptAddFollower-closed', this); }, //-------------------------------------------------------------------------- @@ -76,7 +76,7 @@ FormRenderer.include({ this.on('o_attachments_changed', this, ev => this.trigger_up('reload', { keepChanges: true })); } if (this.chatterFields.hasRecordReloadOnFollowersUpdate) { - owl.Component.env.bus.on('mail.thread:promptAddFollower-closed', this, ev => this.trigger_up('reload', { keepChanges: true })); + owl.Component.env.bus.on('Thread:promptAddFollower-closed', this, ev => this.trigger_up('reload', { keepChanges: true })); } }, /** @@ -177,7 +177,7 @@ FormRenderer.include({ * @param {OdooEvent} ev * @param {Object} ev.data * @param {mail.attachment[]} ev.data.attachments - * @param {mail.thread} ev.data.thread + * @param {Thread} ev.data.thread */ _onChatterRendered(ev) {}, }); diff --git a/addons/website_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/website_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js index b1e4163ae82..987263b6204 100644 --- a/addons/website_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js +++ b/addons/website_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js @@ -10,11 +10,11 @@ patchRecordMethods('MessagingNotificationHandler', { */ async _handleNotification(message) { if (message.type === 'website_livechat.send_chat_request') { - const convertedData = this.messaging.models['mail.thread'].convertData( + const convertedData = this.messaging.models['Thread'].convertData( Object.assign({ model: 'mail.channel' }, message.payload) ); - this.messaging.models['mail.thread'].insert(convertedData); - const channel = this.messaging.models['mail.thread'].findFromIdentifyingData({ + this.messaging.models['Thread'].insert(convertedData); + const channel = this.messaging.models['Thread'].findFromIdentifyingData({ id: message.payload.id, model: 'mail.channel', }); diff --git a/addons/website_livechat/static/src/models/thread/thread.js b/addons/website_livechat/static/src/models/thread/thread.js index 2bf7fb91891..52ca9e896c6 100644 --- a/addons/website_livechat/static/src/models/thread/thread.js +++ b/addons/website_livechat/static/src/models/thread/thread.js @@ -6,7 +6,7 @@ import { insert, unlink } from '@mail/model/model_field_command'; // ensure that the model definition is loaded before the patch import '@mail/models/thread/thread'; -patchModelMethods('mail.thread', { +patchModelMethods('Thread', { /** * @override */ @@ -23,7 +23,7 @@ patchModelMethods('mail.thread', { }, }); -addFields('mail.thread', { +addFields('Thread', { /** * Visitor connected to the livechat. */ diff --git a/addons/website_livechat/static/src/models/visitor/visitor.js b/addons/website_livechat/static/src/models/visitor/visitor.js index 71e931f449d..97a05d5bda5 100644 --- a/addons/website_livechat/static/src/models/visitor/visitor.js +++ b/addons/website_livechat/static/src/models/visitor/visitor.js @@ -129,7 +129,7 @@ registerModel({ /** * Threads with this visitor as member */ - threads: one2many('mail.thread', { + threads: one2many('Thread', { inverse: 'visitor', }), /**