From d1a33597700b0b18dc22c7fbb9e3504589841936 Mon Sep 17 00:00:00 2001 From: payen000 Date: Wed, 6 Sep 2023 12:41:59 -0700 Subject: [PATCH] [REF] mail_tracking: Modified MessagingInitializer inheritance Refactored MessagingInitializer's Init method so that it does not conflict with other modules; see original PR: https://github.com/OCA/social/pull/1091/ Co-authored-by: filoquin --- .../js/models/messaging_initializer.esm.js | 69 ++----------------- 1 file changed, 4 insertions(+), 65 deletions(-) diff --git a/mail_tracking/static/src/js/models/messaging_initializer.esm.js b/mail_tracking/static/src/js/models/messaging_initializer.esm.js index 91edd74b5c..7aea520823 100644 --- a/mail_tracking/static/src/js/models/messaging_initializer.esm.js +++ b/mail_tracking/static/src/js/models/messaging_initializer.esm.js @@ -5,73 +5,12 @@ import {registerPatch} from "@mail/model/model_core"; registerPatch({ name: "MessagingInitializer", recordMethods: { - async _init({ - channels, - companyName, - current_partner, - currentGuest, - current_user_id, - current_user_settings, - hasLinkPreviewFeature, - internalUserGroupId, - mail_failures = [], - menu_id, - needaction_inbox_counter = 0, - partner_root, - public_partners, - shortcodes = [], - starred_counter = 0, - failed_counter = 0, - }) { - const discuss = this.messaging.discuss; - // Partners first because the rest of the code relies on them - this._initPartners({ - currentGuest, - current_partner, - current_user_id, - partner_root, - public_partners, - }); - // Mailboxes after partners and before other initializers that might - // manipulate threads or messages - this._initMailboxes({ - needaction_inbox_counter, - starred_counter, - failed_counter, - }); - // Init mail user settings - if (current_user_settings) { - this.messaging.models["res.users.settings"].insert( - current_user_settings - ); - } - // Various suggestions in no particular order - this._initCannedResponses(shortcodes); - // FIXME: guests should have (at least some) commands available - if (!this.messaging.isCurrentUserGuest) { - this._initCommands(); - } - // Channels when the rest of messaging is ready - if (channels) { - await this._initChannels(channels); - } - if (!this.exists()) { - return; - } - // Failures after channels - this._initMailFailures(mail_failures); - discuss.update({menu_id}); - // Company related data - this.messaging.update({ - companyName, - hasLinkPreviewFeature, - internalUserGroupId, - }); + async _init({failed_counter = 0}) { + await this._super(...arguments); + this._initFailedMailboxes(failed_counter); }, - _initMailboxes({needaction_inbox_counter, starred_counter, failed_counter}) { - this.messaging.inbox.update({counter: needaction_inbox_counter}); - this.messaging.starred.update({counter: starred_counter}); + _initFailedMailboxes(failed_counter) { this.messaging.failedmsg.update({counter: failed_counter}); }, },