From b024377742ad6553174579599e980cbab3a24f01 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Tue, 14 Dec 2021 11:53:58 +0000 Subject: [PATCH] [IMP] mail, sms, snailmail: rename notification group model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename javascript model `mail.notification_group` to `NotificationGroup` in order to distinguish javascript models from python models. Part of task-2701674. closes odoo/odoo#81405 Signed-off-by: Alexandre Kühn (aku) --- .../src/components/notification_group/notification_group.js | 4 ++-- .../src/components/notification_list/notification_list.js | 2 +- .../mail/static/src/models/messaging_menu/messaging_menu.js | 2 +- addons/mail/static/src/models/notification/notification.js | 2 +- .../src/models/notification_group/notification_group.js | 2 +- .../src/models/notification_group/notification_group.js | 2 +- .../src/models/notification_group/notification_group.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/components/notification_group/notification_group.js b/addons/mail/static/src/components/notification_group/notification_group.js index f89b181c631..1d75a2b43ba 100644 --- a/addons/mail/static/src/components/notification_group/notification_group.js +++ b/addons/mail/static/src/components/notification_group/notification_group.js @@ -24,10 +24,10 @@ export class NotificationGroup extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.notification_group} + * @returns {NotificationGroup} */ get group() { - return this.messaging && this.messaging.models['mail.notification_group'].get(this.props.notificationGroupLocalId); + return this.messaging && this.messaging.models['NotificationGroup'].get(this.props.notificationGroupLocalId); } /** diff --git a/addons/mail/static/src/components/notification_list/notification_list.js b/addons/mail/static/src/components/notification_list/notification_list.js index 53ac70f6295..36e238e3596 100644 --- a/addons/mail/static/src/components/notification_list/notification_list.js +++ b/addons/mail/static/src/components/notification_list/notification_list.js @@ -91,7 +91,7 @@ export class NotificationList extends Component { }); let notifications = threadNeedactionNotifications.concat(threadNotifications); if (this.props.filter === 'all') { - notifications = Object.values(this.messaging.models['mail.notification_group'].all()) + notifications = Object.values(this.messaging.models['NotificationGroup'].all()) .sort((group1, group2) => group1.sequence - group2.sequence) .map(notificationGroup => { return { 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 865ff9642c2..a0e7b77aa65 100644 --- a/addons/mail/static/src/models/messaging_menu/messaging_menu.js +++ b/addons/mail/static/src/models/messaging_menu/messaging_menu.js @@ -41,7 +41,7 @@ registerModel({ } const inboxCounter = this.messaging.inbox ? this.messaging.inbox.counter : 0; const unreadChannelsCounter = this.pinnedAndUnreadChannels.length; - const notificationGroupsCounter = this.messaging.models['mail.notification_group'].all().reduce( + const notificationGroupsCounter = this.messaging.models['NotificationGroup'].all().reduce( (total, group) => total + group.notifications.length, 0 ); diff --git a/addons/mail/static/src/models/notification/notification.js b/addons/mail/static/src/models/notification/notification.js index 73c46e59e95..5ecd249845a 100644 --- a/addons/mail/static/src/models/notification/notification.js +++ b/addons/mail/static/src/models/notification/notification.js @@ -143,7 +143,7 @@ registerModel({ message: many2one('mail.message', { inverse: 'notifications', }), - notificationGroup: many2one('mail.notification_group', { + notificationGroup: many2one('NotificationGroup', { compute: '_computeNotificationGroup', inverse: 'notifications', }), 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 c05be1e4bbe..0bd0671b123 100644 --- a/addons/mail/static/src/models/notification_group/notification_group.js +++ b/addons/mail/static/src/models/notification_group/notification_group.js @@ -6,7 +6,7 @@ import { clear, insert, unlink } from '@mail/model/model_field_command'; import { OnChange } from '@mail/model/model_onchange'; registerModel({ - name: 'mail.notification_group', + name: 'NotificationGroup', identifyingFields: ['res_model', 'res_id', 'notification_type'], recordMethods: { /** diff --git a/addons/sms/static/src/models/notification_group/notification_group.js b/addons/sms/static/src/models/notification_group/notification_group.js index 520e47077cb..588ed1ceca5 100644 --- a/addons/sms/static/src/models/notification_group/notification_group.js +++ b/addons/sms/static/src/models/notification_group/notification_group.js @@ -4,7 +4,7 @@ import { patchRecordMethods } from '@mail/model/model_core'; // ensure that the model definition is loaded before the patch import '@mail/models/notification_group/notification_group'; -patchRecordMethods('mail.notification_group', { +patchRecordMethods('NotificationGroup', { /** * @override */ diff --git a/addons/snailmail/static/src/models/notification_group/notification_group.js b/addons/snailmail/static/src/models/notification_group/notification_group.js index 18b1c7249a0..8eb7d634257 100644 --- a/addons/snailmail/static/src/models/notification_group/notification_group.js +++ b/addons/snailmail/static/src/models/notification_group/notification_group.js @@ -4,7 +4,7 @@ import { patchRecordMethods } from '@mail/model/model_core'; // ensure that the model definition is loaded before the patch import '@mail/models/notification_group/notification_group'; -patchRecordMethods('mail.notification_group', { +patchRecordMethods('NotificationGroup', { /** * @override */