From f2877f711a786cd6af539c5f3ae9e61c124d4cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 24 May 2022 14:33:39 +0000 Subject: [PATCH] [IMP] mail: introduce and clean follower views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of task-2810734 closes odoo/odoo#92193 Signed-off-by: Alexandre Kühn (aku) --- .../chatter_topbar/chatter_topbar.xml | 2 - .../src/components/follower/follower.js | 23 +-- .../src/components/follower/follower.xml | 16 +- .../follower_list_menu/follower_list_menu.js | 18 +-- .../follower_list_menu/follower_list_menu.xml | 19 ++- addons/mail/static/src/models/follower.js | 25 +-- .../src/models/follower_list_menu_view.js | 23 ++- .../mail/static/src/models/follower_view.js | 50 ++++++ .../mail/static/tests/helpers/mock_server.js | 4 +- .../components/follower_tests.js | 147 +++++++++--------- 10 files changed, 168 insertions(+), 159 deletions(-) create mode 100644 addons/mail/static/src/models/follower_view.js diff --git a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml index d1bb0da2c86..094b05b32f5 100644 --- a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml +++ b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml @@ -62,8 +62,6 @@ diff --git a/addons/mail/static/src/components/follower/follower.js b/addons/mail/static/src/components/follower/follower.js index 123e4772da5..05523b2e38b 100644 --- a/addons/mail/static/src/components/follower/follower.js +++ b/addons/mail/static/src/components/follower/follower.js @@ -5,31 +5,16 @@ import { registerMessagingComponent } from '@mail/utils/messaging_component'; const { Component } = owl; export class Follower extends Component { - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - /** - * @returns {Follower} + * @returns {FollowerView} */ - get follower() { - return this.props.follower; + get followerView() { + return this.props.record; } - } Object.assign(Follower, { - defaultProps: { - onClick: () => {}, - }, - props: { - follower: Object, - onClick: { - type: Function, - optional: true, - }, - }, + props: { record: Object }, template: 'mail.Follower', }); diff --git a/addons/mail/static/src/components/follower/follower.xml b/addons/mail/static/src/components/follower/follower.xml index 4f9cf41ca65..f2ba85cebd3 100644 --- a/addons/mail/static/src/components/follower/follower.xml +++ b/addons/mail/static/src/components/follower/follower.xml @@ -2,17 +2,17 @@ - -
- - Avatar - + +
+ + Avatar + - - - diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js index a80a9f67e0f..2093b9e2f4f 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js @@ -36,13 +36,6 @@ export class FollowerListMenu extends Component { return this.props.record; } - /** - * @return {Thread} - */ - get thread() { - return this.props.thread; - } - //-------------------------------------------------------------------------- // Handlers //-------------------------------------------------------------------------- @@ -54,7 +47,7 @@ export class FollowerListMenu extends Component { _onClickAddFollowers(ev) { ev.preventDefault(); this.followerListMenuView.hide(); - this.thread.promptAddPartnerFollower(); + this.followerListMenuView.chatterOwner.thread.promptAddPartnerFollower(); } /** @@ -73,14 +66,7 @@ export class FollowerListMenu extends Component { } Object.assign(FollowerListMenu, { - defaultProps: { - isChatterButton: false, - }, - props: { - thread: Object, - isChatterButton: { type: Boolean, optional: true }, - record: Object, - }, + props: { record: Object }, template: 'mail.FollowerListMenu', }); diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml index cc8e6b1db75..066f93858b8 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml @@ -2,33 +2,32 @@ - +
-