From 9fb8749d9489586d5dd102414a22012050d2d70a Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 29 Jun 2023 16:08:51 +0700 Subject: [PATCH 1/2] fix: disable all-members button on admin channel --- .../settings/Report/ReportSettingsPage.js | 9 +++-- .../settings/Report/WriteCapabilityPage.js | 40 ++++++++++--------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/pages/settings/Report/ReportSettingsPage.js b/src/pages/settings/Report/ReportSettingsPage.js index 53f0b99910bb..78e73cf75146 100644 --- a/src/pages/settings/Report/ReportSettingsPage.js +++ b/src/pages/settings/Report/ReportSettingsPage.js @@ -97,9 +97,12 @@ class ReportSettingsPage extends Component { const shouldDisableRename = this.shouldDisableRename(linkedWorkspace) || ReportUtils.isThread(this.props.report); const notificationPreference = this.props.translate(`notificationPreferencesPage.notificationPreferences.${this.props.report.notificationPreference}`); const shouldDisableWelcomeMessage = this.shouldDisableWelcomeMessage(linkedWorkspace); - const writeCapability = this.props.report.writeCapability || CONST.REPORT.WRITE_CAPABILITIES.ALL; + const writeCapability = ReportUtils.isAdminRoom(this.props.report) + ? CONST.REPORT.WRITE_CAPABILITIES.ADMINS + : this.props.report.writeCapability || CONST.REPORT.WRITE_CAPABILITIES.ALL; + const writeCapabilityText = this.props.translate(`writeCapabilityPage.writeCapability.${writeCapability}`); - const shouldAllowWriteCapabilityEditing = lodashGet(linkedWorkspace, 'role', '') === CONST.POLICY.ROLE.ADMIN; + const shouldAllowWriteCapabilityEditing = lodashGet(linkedWorkspace, 'role', '') === CONST.POLICY.ROLE.ADMIN && !ReportUtils.isAdminRoom(this.props.report); return ( @@ -148,7 +151,7 @@ class ReportSettingsPage extends Component { )} {shouldAllowWriteCapabilityEditing ? ( Navigation.navigate(ROUTES.getReportSettingsWriteCapabilityRoute(this.props.report.reportID))} diff --git a/src/pages/settings/Report/WriteCapabilityPage.js b/src/pages/settings/Report/WriteCapabilityPage.js index 381d21785564..bfec919fddc8 100644 --- a/src/pages/settings/Report/WriteCapabilityPage.js +++ b/src/pages/settings/Report/WriteCapabilityPage.js @@ -14,6 +14,8 @@ import ROUTES from '../../../ROUTES'; import * as Report from '../../../libs/actions/Report'; import * as Expensicons from '../../../components/Icon/Expensicons'; import themeColors from '../../../styles/themes/default'; +import * as ReportUtils from '../../../libs/ReportUtils'; +import FullPageNotFoundView from '../../../components/BlockingViews/FullPageNotFoundView'; const propTypes = { ...withLocalizePropTypes, @@ -38,24 +40,26 @@ function WriteCapabilityPage(props) { return ( - Navigation.goBack(ROUTES.getReportSettingsRoute(props.report.reportID))} - /> - Report.updateWriteCapabilityAndNavigate(props.report, option.value)} - hideSectionHeaders - optionHoveredStyle={{ - ...styles.hoveredComponentBG, - ...styles.mhn5, - ...styles.ph5, - }} - shouldHaveOptionSeparator - shouldDisableRowInnerPadding - contentContainerStyles={[styles.ph5]} - /> + + Navigation.goBack(ROUTES.getReportSettingsRoute(props.report.reportID))} + /> + Report.updateWriteCapabilityAndNavigate(props.report, option.value)} + hideSectionHeaders + optionHoveredStyle={{ + ...styles.hoveredComponentBG, + ...styles.mhn5, + ...styles.ph5, + }} + shouldHaveOptionSeparator + shouldDisableRowInnerPadding + contentContainerStyles={[styles.ph5]} + /> + ); } From 390b501efb7d61175c8576a848dc970ae1efb8cb Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 4 Jul 2023 19:34:58 +0700 Subject: [PATCH 2/2] remove redandunt --- src/pages/settings/Report/ReportSettingsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Report/ReportSettingsPage.js b/src/pages/settings/Report/ReportSettingsPage.js index 78e73cf75146..ea7069bfe72c 100644 --- a/src/pages/settings/Report/ReportSettingsPage.js +++ b/src/pages/settings/Report/ReportSettingsPage.js @@ -151,7 +151,7 @@ class ReportSettingsPage extends Component { )} {shouldAllowWriteCapabilityEditing ? ( Navigation.navigate(ROUTES.getReportSettingsWriteCapabilityRoute(this.props.report.reportID))}