From 3ec2b9e5b58db69f59640d194bca6497f107ebda Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Mon, 13 Dec 2021 17:06:33 +0000 Subject: [PATCH] [IMP] mail: rename follower model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename javascript model `mail.follower` to `Follower` in order to distinguish javascript models from python models. Part of task-2701674. closes odoo/odoo#81369 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/components/follower/follower.js | 4 ++-- .../src/components/follower/tests/follower_tests.js | 8 ++++---- .../follower_list_menu/tests/follower_list_menu_tests.js | 2 +- .../src/components/follower_subtype/follower_subtype.js | 4 ++-- .../follower_subtype/tests/follower_subtype_tests.js | 6 +++--- addons/mail/static/src/models/follower/follower.js | 2 +- .../models/follower_subtype_list/follower_subtype_list.js | 2 +- addons/mail/static/src/models/thread/thread.js | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/mail/static/src/components/follower/follower.js b/addons/mail/static/src/components/follower/follower.js index baae2fa6353..17005dd81ba 100644 --- a/addons/mail/static/src/components/follower/follower.js +++ b/addons/mail/static/src/components/follower/follower.js @@ -11,10 +11,10 @@ export class Follower extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.follower} + * @returns {Follower} */ get follower() { - return this.messaging && this.messaging.models['mail.follower'].get(this.props.followerLocalId); + return this.messaging && this.messaging.models['Follower'].get(this.props.followerLocalId); } //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/follower/tests/follower_tests.js b/addons/mail/static/src/components/follower/tests/follower_tests.js index e8fb5342476..688a5474083 100644 --- a/addons/mail/static/src/components/follower/tests/follower_tests.js +++ b/addons/mail/static/src/components/follower/tests/follower_tests.js @@ -48,7 +48,7 @@ QUnit.test('base rendering not editable', async function (assert) { id: 100, model: 'res.partner', }); - const follower = await this.messaging.models['mail.follower'].create({ + const follower = await this.messaging.models['Follower'].create({ partner: insert({ id: 1, name: "François Perusse", @@ -94,7 +94,7 @@ QUnit.test('base rendering editable', async function (assert) { id: 100, model: 'res.partner', }); - const follower = await this.messaging.models['mail.follower'].create({ + const follower = await this.messaging.models['Follower'].create({ partner: insert({ id: 1, name: "François Perusse", @@ -169,7 +169,7 @@ QUnit.test('click on partner follower details', async function (assert) { id: 100, model: 'res.partner', }); - const follower = await this.messaging.models['mail.follower'].create({ + const follower = await this.messaging.models['Follower'].create({ followedThread: link(thread), id: 2, isActive: true, @@ -275,7 +275,7 @@ QUnit.test('edit follower and close subtype dialog', async function (assert) { id: 100, model: 'res.partner', }); - const follower = await this.messaging.models['mail.follower'].create({ + const follower = await this.messaging.models['Follower'].create({ followedThread: link(thread), id: 2, isActive: true, diff --git a/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js b/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js index d910f7727a5..4b082ba3cb5 100644 --- a/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js +++ b/addons/mail/static/src/components/follower_list_menu/tests/follower_list_menu_tests.js @@ -251,7 +251,7 @@ QUnit.test('click on remove follower', async function (assert) { id: 100, model: 'res.partner', }); - await this.messaging.models['mail.follower'].create({ + await this.messaging.models['Follower'].create({ followedThread: link(thread), id: 2, isActive: true, diff --git a/addons/mail/static/src/components/follower_subtype/follower_subtype.js b/addons/mail/static/src/components/follower_subtype/follower_subtype.js index fb51d21753d..29fcf6ff442 100644 --- a/addons/mail/static/src/components/follower_subtype/follower_subtype.js +++ b/addons/mail/static/src/components/follower_subtype/follower_subtype.js @@ -11,10 +11,10 @@ export class FollowerSubtype extends Component { //-------------------------------------------------------------------------- /** - * @returns {mail.follower|undefined} + * @returns {Follower|undefined} */ get follower() { - return this.messaging && this.messaging.models['mail.follower'].get(this.props.followerLocalId); + return this.messaging && this.messaging.models['Follower'].get(this.props.followerLocalId); } /** diff --git a/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js b/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js index 8c014517287..5865c3381a7 100644 --- a/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js +++ b/addons/mail/static/src/components/follower_subtype/tests/follower_subtype_tests.js @@ -49,7 +49,7 @@ QUnit.test('simplest layout of a followed subtype', async function (assert) { id: 100, model: 'res.partner', }); - const follower = this.messaging.models['mail.follower'].create({ + const follower = this.messaging.models['Follower'].create({ partner: insert({ id: 1, name: "François Perusse", @@ -109,7 +109,7 @@ QUnit.test('simplest layout of a not followed subtype', async function (assert) id: 100, model: 'res.partner', }); - const follower = this.messaging.models['mail.follower'].create({ + const follower = this.messaging.models['Follower'].create({ partner: insert({ id: 1, name: "François Perusse", @@ -166,7 +166,7 @@ QUnit.test('toggle follower subtype checkbox', async function (assert) { id: 100, model: 'res.partner', }); - const follower = this.messaging.models['mail.follower'].create({ + const follower = this.messaging.models['Follower'].create({ partner: insert({ id: 1, name: "François Perusse", diff --git a/addons/mail/static/src/models/follower/follower.js b/addons/mail/static/src/models/follower/follower.js index b7e2917eed1..6f7ae0adf93 100644 --- a/addons/mail/static/src/models/follower/follower.js +++ b/addons/mail/static/src/models/follower/follower.js @@ -5,7 +5,7 @@ import { attr, many2many, many2one, one2many } from '@mail/model/model_field'; import { clear, insert, insertAndReplace, link, replace, unlink, unlinkAll } from '@mail/model/model_field_command'; registerModel({ - name: 'mail.follower', + name: 'Follower', identifyingFields: ['id'], modelMethods: { /** diff --git a/addons/mail/static/src/models/follower_subtype_list/follower_subtype_list.js b/addons/mail/static/src/models/follower_subtype_list/follower_subtype_list.js index 8c8665eaec3..0c973abeaa7 100644 --- a/addons/mail/static/src/models/follower_subtype_list/follower_subtype_list.js +++ b/addons/mail/static/src/models/follower_subtype_list/follower_subtype_list.js @@ -15,7 +15,7 @@ registerModel({ isCausal: true, readonly: true, }), - follower: many2one('mail.follower', { + follower: many2one('Follower', { inverse: 'subtypeList', readonly: true, required: true, diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 1245b41de89..5f3f9ae92c3 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -1038,7 +1038,7 @@ registerModel({ if (followers.length > 0) { this.update({ followers: insertAndReplace(followers.map(data => - this.messaging.models['mail.follower'].convertData(data)) + this.messaging.models['Follower'].convertData(data)) ), }); } else { @@ -1996,7 +1996,7 @@ registerModel({ followersPartner: many2many('mail.partner', { related: 'followers.partner', }), - followers: one2many('mail.follower', { + followers: one2many('Follower', { inverse: 'followedThread', }), /**