From 0ee5e2b99a2d9097b2d93ab71de38a66479fdd59 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 26 Jan 2023 22:52:55 +0700 Subject: [PATCH 1/4] fix: issue --- src/pages/ReportDetailsPage.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 1b3af0732570..615dad7ea758 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -54,34 +54,33 @@ const propTypes = { }; class ReportDetailsPage extends Component { - constructor(props) { - super(props); - - this.menuItems = []; + getMenuItems() { if (ReportUtils.isArchivedRoom(this.props.report)) { return; } + const menuItems = []; + // All nonarchived chats should let you see their members - this.menuItems.push({ + menuItems.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS, translationKey: 'common.members', icon: Expensicons.Users, - subtitle: lodashGet(props.report, 'participants', []).length, - action: () => { Navigation.navigate(ROUTES.getReportParticipantsRoute(props.report.reportID)); }, + subtitle: lodashGet(this.props.report, 'participants', []).length, + action: () => { Navigation.navigate(ROUTES.getReportParticipantsRoute(this.props.report.reportID)); }, }); if (ReportUtils.isPolicyExpenseChat(this.props.report) || ReportUtils.isChatRoom(this.props.report)) { - this.menuItems.push({ + menuItems.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS, translationKey: 'common.settings', icon: Expensicons.Gear, - action: () => { Navigation.navigate(ROUTES.getReportSettingsRoute(props.report.reportID)); }, + action: () => { Navigation.navigate(ROUTES.getReportSettingsRoute(this.props.report.reportID)); }, }); } if (ReportUtils.isUserCreatedPolicyRoom(this.props.report)) { - this.menuItems.push({ + menuItems.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.INVITE, translationKey: 'common.invite', icon: Expensicons.Plus, @@ -94,6 +93,7 @@ class ReportDetailsPage extends Component { action: () => { /* Placeholder for when leaving rooms is built in */ }, }); } + return menuItems; } render() { @@ -106,6 +106,7 @@ class ReportDetailsPage extends Component { OptionsListUtils.getPersonalDetailsForLogins(participants, this.props.personalDetails), isMultipleParticipant, ); + const menuItems = this.getMenuItems(); return ( - {_.map(this.menuItems, (item) => { + {_.map(menuItems, (item) => { const brickRoadIndicator = ( ReportUtils.hasReportNameError(this.props.report) && item.key === CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS From 4c162e5f33e5f2d017a970a410464e70ad99ddd8 Mon Sep 17 00:00:00 2001 From: tienifr <113963320+tienifr@users.noreply.github.com> Date: Fri, 27 Jan 2023 22:23:20 +0700 Subject: [PATCH 2/4] Update src/pages/ReportDetailsPage.js Co-authored-by: Rajat Parashar --- src/pages/ReportDetailsPage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 615dad7ea758..09a81c5cd7ec 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -55,12 +55,12 @@ const propTypes = { class ReportDetailsPage extends Component { getMenuItems() { + const menuItems = []; + if (ReportUtils.isArchivedRoom(this.props.report)) { - return; + return []; } - const menuItems = []; - // All nonarchived chats should let you see their members menuItems.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS, From 11eef34a29588a364ec33cd2448de2f36feab4b2 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 27 Jan 2023 22:38:30 +0700 Subject: [PATCH 3/4] fix: issue --- src/pages/ReportDetailsPage.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 09a81c5cd7ec..73d0584ede7b 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -54,8 +54,13 @@ const propTypes = { }; class ReportDetailsPage extends Component { + // eslint-disable-next-line no-useless-constructor + constructor(props) { + super(props); + } + getMenuItems() { - const menuItems = []; + const menuItems = []; if (ReportUtils.isArchivedRoom(this.props.report)) { return []; From aaf814ebc173e75d3e79a05667c090479a5b974d Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 30 Jan 2023 22:38:43 +0700 Subject: [PATCH 4/4] fix: remove redundant --- src/pages/ReportDetailsPage.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 73d0584ede7b..b97b31e7e5de 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -54,11 +54,6 @@ const propTypes = { }; class ReportDetailsPage extends Component { - // eslint-disable-next-line no-useless-constructor - constructor(props) { - super(props); - } - getMenuItems() { const menuItems = [];