diff --git a/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.js b/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.js index d12c00892e4..20ca571ab60 100644 --- a/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.js +++ b/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.js @@ -18,7 +18,7 @@ patch(components.DiscussSidebar.prototype, 'im_livechat/static/src/components/di * @returns {mail.thread[]} */ quickSearchOrderedAndPinnedLivechatList() { - const allOrderedAndPinnedLivechats = this.env.models['mail.thread'] + const allOrderedAndPinnedLivechats = this.messaging.models['mail.thread'] .all(thread => thread.channel_type === 'livechat' && thread.isPinned && 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 ad6fa3496ab..dd8fcc36911 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.env.models['mail.thread'].all(thread => + return this.messaging.models['mail.thread'].all(thread => thread.channel_type === 'livechat' && thread.isPinned && thread.model === 'mail.channel' diff --git a/addons/mail/static/src/component_hooks/use_component_to_model/use_component_to_model.js b/addons/mail/static/src/component_hooks/use_component_to_model/use_component_to_model.js index a31c95903a3..36ae5fec42b 100644 --- a/addons/mail/static/src/component_hooks/use_component_to_model/use_component_to_model.js +++ b/addons/mail/static/src/component_hooks/use_component_to_model/use_component_to_model.js @@ -17,23 +17,24 @@ const { onWillUpdateProps, useComponent } = owl.hooks; */ export function useComponentToModel({ fieldName, modelName, propNameAsRecordLocalId }) { const component = useComponent(); - const record = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const { modelManager } = component.env.services.messaging; + const record = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (record) { record.update({ [fieldName]: component }); } onWillUpdateProps(nextProps => { - const currentRecord = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const currentRecord = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (currentRecord) { currentRecord.update({ [fieldName]: clear() }); } - const nextRecord = component.env.models[modelName].get(nextProps[propNameAsRecordLocalId]); + const nextRecord = modelManager.models[modelName].get(nextProps[propNameAsRecordLocalId]); if (nextRecord) { nextRecord.update({ [fieldName]: component }); } }); const __destroy = component.__destroy; component.__destroy = parent => { - const record = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const record = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (record) { record.update({ [fieldName]: clear() }); } diff --git a/addons/mail/static/src/component_hooks/use_ref_to_model/use_ref_to_model.js b/addons/mail/static/src/component_hooks/use_ref_to_model/use_ref_to_model.js index 7c5ab390dcc..439910e919d 100644 --- a/addons/mail/static/src/component_hooks/use_ref_to_model/use_ref_to_model.js +++ b/addons/mail/static/src/component_hooks/use_ref_to_model/use_ref_to_model.js @@ -18,24 +18,25 @@ const { onWillUpdateProps, useComponent, useRef } = owl.hooks; */ export function useRefToModel({ fieldName, modelName, propNameAsRecordLocalId, refName }) { const component = useComponent(); - const record = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const { modelManager } = component.env.services.messaging; + const record = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); const ref = useRef(refName); if (record) { record.update({ [fieldName]: ref }); } onWillUpdateProps(nextProps => { - const currentRecord = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const currentRecord = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (currentRecord) { currentRecord.update({ [fieldName]: clear() }); } - const nextRecord = component.env.models[modelName].get(nextProps[propNameAsRecordLocalId]); + const nextRecord = modelManager.models[modelName].get(nextProps[propNameAsRecordLocalId]); if (nextRecord) { nextRecord.update({ [fieldName]: ref }); } }); const __destroy = component.__destroy; component.__destroy = parent => { - const record = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const record = modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (record) { record.update({ [fieldName]: clear() }); } diff --git a/addons/mail/static/src/component_hooks/use_update_to_model/use_update_to_model.js b/addons/mail/static/src/component_hooks/use_update_to_model/use_update_to_model.js index 1e411ed12a9..f9521474ec6 100644 --- a/addons/mail/static/src/component_hooks/use_update_to_model/use_update_to_model.js +++ b/addons/mail/static/src/component_hooks/use_update_to_model/use_update_to_model.js @@ -17,7 +17,7 @@ const { useComponent } = owl.hooks; export function useUpdateToModel({ methodName, modelName, propNameAsRecordLocalId }) { const component = useComponent(); useUpdate({ func: () => { - const record = component.env.models[modelName].get(component.props[propNameAsRecordLocalId]); + const record = component.env.services.messaging.modelManager.models[modelName].get(component.props[propNameAsRecordLocalId]); if (record) { record[methodName](); } diff --git a/addons/mail/static/src/components/activity/activity.js b/addons/mail/static/src/components/activity/activity.js index 3f701d1f4f6..dcf4fa321be 100644 --- a/addons/mail/static/src/components/activity/activity.js +++ b/addons/mail/static/src/components/activity/activity.js @@ -36,7 +36,7 @@ export class Activity extends Component { * @returns {mail.activity} */ get activity() { - return this.env.models['mail.activity'].get(this.props.activityLocalId); + return this.messaging && this.messaging.models['mail.activity'].get(this.props.activityLocalId); } /** diff --git a/addons/mail/static/src/components/activity/tests/activity_tests.js b/addons/mail/static/src/components/activity/tests/activity_tests.js index 0b1ef7adffd..caea8456c28 100644 --- a/addons/mail/static/src/components/activity/tests/activity_tests.js +++ b/addons/mail/static/src/components/activity/tests/activity_tests.js @@ -975,7 +975,7 @@ QUnit.test('activity click on cancel', async function (assert) { * @returns {mail.activity} */ get activity() { - return this.env.models['mail.activity'].get(this.props.activityLocalId); + return this.messaging.models['mail.activity'].get(this.props.activityLocalId); } } ParentComponent.env = this.env; diff --git a/addons/mail/static/src/components/activity_box/activity_box.js b/addons/mail/static/src/components/activity_box/activity_box.js index e570202d9cb..e053423387b 100644 --- a/addons/mail/static/src/components/activity_box/activity_box.js +++ b/addons/mail/static/src/components/activity_box/activity_box.js @@ -14,7 +14,7 @@ export class ActivityBox extends Component { * @returns {Chatter} */ get chatter() { - return this.env.models['mail.chatter'].get(this.props.chatterLocalId); + return this.messaging.models['mail.chatter'].get(this.props.chatterLocalId); } } diff --git a/addons/mail/static/src/components/activity_mark_done_popover/activity_mark_done_popover.js b/addons/mail/static/src/components/activity_mark_done_popover/activity_mark_done_popover.js index e306159b43f..21bc13b79b1 100644 --- a/addons/mail/static/src/components/activity_mark_done_popover/activity_mark_done_popover.js +++ b/addons/mail/static/src/components/activity_mark_done_popover/activity_mark_done_popover.js @@ -30,7 +30,7 @@ export class ActivityMarkDonePopover extends Component { * @returns {mail.activity} */ get activity() { - return this.env.models['mail.activity'].get(this.props.activityLocalId); + return this.messaging && this.messaging.models['mail.activity'].get(this.props.activityLocalId); } /** diff --git a/addons/mail/static/src/components/attachment/attachment.js b/addons/mail/static/src/components/attachment/attachment.js index 3ef672467f3..c37593973dd 100644 --- a/addons/mail/static/src/components/attachment/attachment.js +++ b/addons/mail/static/src/components/attachment/attachment.js @@ -24,7 +24,7 @@ export class Attachment extends Component { * @returns {mail.attachment} */ get attachment() { - return this.env.models['mail.attachment'].get(this.props.attachmentLocalId); + return this.messaging && this.messaging.models['mail.attachment'].get(this.props.attachmentLocalId); } /** @@ -115,10 +115,10 @@ export class Attachment extends Component { if (!this.attachment.isViewable) { return; } - this.env.models['mail.attachment'].view({ + this.messaging.models['mail.attachment'].view({ attachment: this.attachment, attachments: this.props.attachmentLocalIds.map( - attachmentLocalId => this.env.models['mail.attachment'].get(attachmentLocalId) + attachmentLocalId => this.messaging.models['mail.attachment'].get(attachmentLocalId) ), }); } diff --git a/addons/mail/static/src/components/attachment_box/attachment_box.js b/addons/mail/static/src/components/attachment_box/attachment_box.js index be9e74e6fa1..17d626ff9ee 100644 --- a/addons/mail/static/src/components/attachment_box/attachment_box.js +++ b/addons/mail/static/src/components/attachment_box/attachment_box.js @@ -42,7 +42,7 @@ export class AttachmentBox extends Component { * @returns {mail.thread|undefined} */ get thread() { - return this.env.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['mail.thread'].get(this.props.threadLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/attachment_delete_confirm_dialog/attachment_delete_confirm_dialog.js b/addons/mail/static/src/components/attachment_delete_confirm_dialog/attachment_delete_confirm_dialog.js index 277b249bff5..d892416cd46 100644 --- a/addons/mail/static/src/components/attachment_delete_confirm_dialog/attachment_delete_confirm_dialog.js +++ b/addons/mail/static/src/components/attachment_delete_confirm_dialog/attachment_delete_confirm_dialog.js @@ -26,7 +26,7 @@ export class AttachmentDeleteConfirmDialog extends Component { * @returns {mail.attachment} */ get attachment() { - return this.env.models['mail.attachment'].get(this.props.attachmentLocalId); + return this.messaging && this.messaging.models['mail.attachment'].get(this.props.attachmentLocalId); } /** diff --git a/addons/mail/static/src/components/attachment_list/attachment_list.js b/addons/mail/static/src/components/attachment_list/attachment_list.js index fc3a1ebcb13..b5405687c12 100644 --- a/addons/mail/static/src/components/attachment_list/attachment_list.js +++ b/addons/mail/static/src/components/attachment_list/attachment_list.js @@ -14,7 +14,7 @@ export class AttachmentList extends Component { * @returns {mail.attachment[]} */ get attachments() { - return this.env.models['mail.attachment'].all().filter(attachment => + return this.messaging && this.messaging.models['mail.attachment'].all().filter(attachment => this.props.attachmentLocalIds.includes(attachment.localId) ); } diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js index 87e44692022..a5178483663 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js @@ -80,7 +80,7 @@ export class AttachmentViewer extends Component { * @returns {mail.attachment_viewer} */ get attachmentViewer() { - return this.env.models['mail.attachment_viewer'].get(this.props.localId); + return this.messaging && this.messaging.models['mail.attachment_viewer'].get(this.props.localId); } /** diff --git a/addons/mail/static/src/components/channel_invitation_form/channel_invitation_form.js b/addons/mail/static/src/components/channel_invitation_form/channel_invitation_form.js index fac83d8be71..ad984717884 100644 --- a/addons/mail/static/src/components/channel_invitation_form/channel_invitation_form.js +++ b/addons/mail/static/src/components/channel_invitation_form/channel_invitation_form.js @@ -24,7 +24,7 @@ export class ChannelInvitationForm extends Component { //-------------------------------------------------------------------------- get channelInvitationForm() { - return this.env.models['mail.channel_invitation_form'].get(this.props.localId); + return this.messaging && this.messaging.models['mail.channel_invitation_form'].get(this.props.localId); } } diff --git a/addons/mail/static/src/components/chat_window/chat_window.js b/addons/mail/static/src/components/chat_window/chat_window.js index 7f56e0e34f4..67753e14328 100644 --- a/addons/mail/static/src/components/chat_window/chat_window.js +++ b/addons/mail/static/src/components/chat_window/chat_window.js @@ -52,7 +52,7 @@ export class ChatWindow extends Component { * @returns {mail.chat_window} */ get chatWindow() { - return this.env.models['mail.chat_window'].get(this.props.chatWindowLocalId); + return this.messaging && this.messaging.models['mail.chat_window'].get(this.props.chatWindowLocalId); } /** @@ -181,7 +181,7 @@ export class ChatWindow extends Component { * @param {function} res */ _onAutocompleteSource(req, res) { - this.env.models['mail.partner'].imSearch({ + this.messaging.models['mail.partner'].imSearch({ callback: (partners) => { const suggestions = partners.map(partner => { return { diff --git a/addons/mail/static/src/components/chat_window_header/chat_window_header.js b/addons/mail/static/src/components/chat_window_header/chat_window_header.js index 49ce57afeb9..f8084386ed1 100644 --- a/addons/mail/static/src/components/chat_window_header/chat_window_header.js +++ b/addons/mail/static/src/components/chat_window_header/chat_window_header.js @@ -18,7 +18,7 @@ export class ChatWindowHeader extends Component { * @returns {mail.chat_window} */ get chatWindow() { - return this.env.models['mail.chat_window'].get(this.props.chatWindowLocalId); + return this.messaging && this.messaging.models['mail.chat_window'].get(this.props.chatWindowLocalId); } /** diff --git a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js index dfa59601160..44ec50d5fde 100644 --- a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js +++ b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js @@ -45,6 +45,9 @@ export class ChatWindowHiddenMenu extends Component { * @private */ _apply() { + if (!this.messaging) { + return; + } this._applyListHeight(); this._applyOffset(); this._wasMenuOpen = this.env.messaging.chatWindowManager.isHiddenMenuOpen; diff --git a/addons/mail/static/src/components/chatter/chatter.js b/addons/mail/static/src/components/chatter/chatter.js index 3fa8307cf57..bafaee60a9a 100644 --- a/addons/mail/static/src/components/chatter/chatter.js +++ b/addons/mail/static/src/components/chatter/chatter.js @@ -38,7 +38,7 @@ export class Chatter extends Component { * @returns {mail.chatter} */ get chatter() { - return this.env.models['mail.chatter'].get(this.props.chatterLocalId); + return this.messaging && this.messaging.models['mail.chatter'].get(this.props.chatterLocalId); } /** diff --git a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js index 069a8c4c2cb..0d70fd0c9f3 100644 --- a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js +++ b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js @@ -14,7 +14,7 @@ export class ChatterTopbar extends Component { * @returns {mail.chatter} */ get chatter() { - return this.env.models['mail.chatter'].get(this.props.chatterLocalId); + return this.messaging && this.messaging.models['mail.chatter'].get(this.props.chatterLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/composer/composer.js b/addons/mail/static/src/components/composer/composer.js index 9b854620b8b..df6c1d364af 100644 --- a/addons/mail/static/src/components/composer/composer.js +++ b/addons/mail/static/src/components/composer/composer.js @@ -54,7 +54,7 @@ export class Composer extends Component { * @returns {mail.composer} */ get composer() { - return this.env.models['mail.composer'].get(this.props.composerLocalId); + return this.messaging && this.messaging.models['mail.composer'].get(this.props.composerLocalId); } /** diff --git a/addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js b/addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js index 91e6c16506b..b2c8ad3182c 100644 --- a/addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js +++ b/addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js @@ -78,7 +78,7 @@ export class ComposerSuggestedRecipient extends Component { * @returns {mail.suggested_recipient_info} */ get suggestedRecipientInfo() { - return this.env.models['mail.suggested_recipient_info'].get(this.props.suggestedRecipientInfoLocalId); + return this.messaging && this.messaging.models['mail.suggested_recipient_info'].get(this.props.suggestedRecipientInfoLocalId); } //-------------------------------------------------------------------------- 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 b58c9c7f297..f8258eaa7aa 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 @@ -25,7 +25,7 @@ export class ComposerSuggestedRecipientList extends Component { * @returns {mail.thread} */ get thread() { - return this.env.models['mail.thread'].get(this.props.threadLocalId); + return this.messaging && this.messaging.models['mail.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 b3bb9b7fa6f..1b1715f5fd5 100644 --- a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js +++ b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js @@ -24,7 +24,7 @@ export class ComposerSuggestion extends Component { * @returns {mail.composer} */ get composer() { - return this.env.models['mail.composer'].get(this.props.composerLocalId); + return this.messaging && this.messaging.models['mail.composer'].get(this.props.composerLocalId); } get isCannedResponse() { @@ -44,7 +44,7 @@ export class ComposerSuggestion extends Component { } get record() { - return this.env.models[this.props.modelName].get(this.props.recordLocalId); + return this.messaging && this.messaging.models[this.props.modelName].get(this.props.recordLocalId); } /** diff --git a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.js b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.js index 36ce83b5a55..8621ce65e51 100644 --- a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.js +++ b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.js @@ -14,7 +14,7 @@ export class ComposerSuggestionList extends Component { * @returns {mail.composer} */ get composer() { - return this.env.models['mail.composer'].get(this.props.composerLocalId); + return this.messaging && this.messaging.models['mail.composer'].get(this.props.composerLocalId); } } diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.js b/addons/mail/static/src/components/composer_text_input/composer_text_input.js index 8b25f389e76..e9f4620b2c9 100644 --- a/addons/mail/static/src/components/composer_text_input/composer_text_input.js +++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.js @@ -44,7 +44,7 @@ export class ComposerTextInput extends Component { * @returns {mail.composer} */ get composer() { - return this.env.models['mail.composer'].get(this.props.composerLocalId); + return this.messaging && this.messaging.models['mail.composer'].get(this.props.composerLocalId); } /** diff --git a/addons/mail/static/src/components/dialog/dialog.js b/addons/mail/static/src/components/dialog/dialog.js index a4e5bca5246..bcc0331b905 100644 --- a/addons/mail/static/src/components/dialog/dialog.js +++ b/addons/mail/static/src/components/dialog/dialog.js @@ -44,7 +44,7 @@ export class Dialog extends Component { * @returns {mail.dialog} */ get dialog() { - return this.env.models['mail.dialog'].get(this.props.dialogLocalId); + return this.messaging && this.messaging.models['mail.dialog'].get(this.props.dialogLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/discuss/discuss.js b/addons/mail/static/src/components/discuss/discuss.js index e80fde04eee..df879716f4f 100644 --- a/addons/mail/static/src/components/discuss/discuss.js +++ b/addons/mail/static/src/components/discuss/discuss.js @@ -27,6 +27,9 @@ export class Discuss extends Component { } mounted() { + if (!this.discuss) { + return; + } this.discuss.update({ isOpen: true }); if (this.discuss.thread) { this.trigger('o-push-state-action-manager'); @@ -114,6 +117,9 @@ export class Discuss extends Component { * @private */ _updateLocalStoreProps() { + if (!this.discuss) { + return; + } /** * Locally tracked store props `activeThreadCache`. * Useful to set scroll position from last stored one and to display 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 23a5ea95b94..99fd938b506 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -38,6 +38,18 @@ QUnit.module('discuss_tests.js', { }, }); +QUnit.test('messaging not created', async function (assert) { + assert.expect(1); + + const messagingBeforeCreationDeferred = makeTestPromise(); + await this.start({ + messagingBeforeCreationDeferred, + waitUntilMessagingCondition: 'none' + }); + assert.containsOnce(document.body, '.o_Discuss_messagingNotInitialized', "should display messaging not initialized"); + messagingBeforeCreationDeferred.resolve(); +}); + QUnit.test('messaging not initialized', async function (assert) { assert.expect(1); 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 fcd10df9cdc..b37b5c4bd70 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 @@ -14,7 +14,10 @@ export class DiscussMobileMailboxSelection extends Component { * @returns {mail.thread[]} */ get orderedMailboxes() { - return this.env.models['mail.thread'] + if (!this.messaging) { + return []; + } + return this.messaging.models['mail.thread'] .all(thread => thread.isPinned && thread.model === 'mail.box') .sort((mailbox1, mailbox2) => { if (mailbox1 === this.discuss.messaging.inbox) { @@ -54,7 +57,7 @@ export class DiscussMobileMailboxSelection extends Component { */ _onClick(ev) { const { mailboxLocalId } = ev.currentTarget.dataset; - const mailbox = this.env.models['mail.thread'].get(mailboxLocalId); + const mailbox = this.messaging.models['mail.thread'].get(mailboxLocalId); if (!mailbox) { return; } diff --git a/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.js b/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.js index ac6785e1cef..4a5b3a445a8 100644 --- a/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.js +++ b/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.js @@ -49,7 +49,7 @@ export class DiscussSidebar extends Component { * @returns {mail.thread[]} */ get orderedMailboxes() { - return this.env.models['mail.thread'] + return this.messaging.models['mail.thread'] .all(thread => thread.isPinned && thread.model === 'mail.box') .sort((mailbox1, mailbox2) => { if (mailbox1 === this.discuss.messaging.inbox) { @@ -76,7 +76,7 @@ export class DiscussSidebar extends Component { * @returns {mail.thread[]} */ get quickSearchPinnedAndOrderedChats() { - const allOrderedAndPinnedChats = this.env.models['mail.thread'] + const allOrderedAndPinnedChats = this.messaging.models['mail.thread'] .all(thread => thread.channel_type === 'chat' && thread.isPinned && @@ -99,7 +99,7 @@ export class DiscussSidebar extends Component { * @returns {mail.thread[]} */ get quickSearchOrderedAndPinnedMultiUserChannels() { - const allOrderedAndPinnedMultiUserChannels = this.env.models['mail.thread'] + const allOrderedAndPinnedMultiUserChannels = this.messaging.models['mail.thread'] .all(thread => thread.channel_type === 'channel' && thread.isPinned && 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 d0efa9bfdf8..0859456cc62 100644 --- a/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml +++ b/addons/mail/static/src/components/discuss_sidebar/discuss_sidebar.xml @@ -13,7 +13,7 @@