diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 339dd2c6e259..5c62eb336ed5 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -365,7 +365,7 @@ function getOptions(reports, personalDetails, activeReportID, { selectedOptions = [], maxRecentReportsToShow = 0, excludeLogins = [], - excludeDefaultRooms = false, + excludeChatRooms = false, includeMultipleParticipantReports = false, includePersonalDetails = false, includeRecentReports = false, @@ -439,11 +439,11 @@ function getOptions(reports, personalDetails, activeReportID, { return; } - if (isChatRoom && (!Permissions.canUseDefaultRooms(betas) || excludeDefaultRooms)) { + if (isChatRoom && excludeChatRooms) { return; } - if (isPolicyExpenseChat && !Permissions.canUsePolicyExpenseChat(betas)) { + if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas)) { return; } @@ -451,6 +451,10 @@ function getOptions(reports, personalDetails, activeReportID, { return; } + if (isPolicyExpenseChat && !Permissions.canUsePolicyExpenseChat(betas)) { + return; + } + // Save the report in the map if this is a single participant so we can associate the reportID with the // personal detail option later. Individuals should not be associated with single participant // policyExpenseChats or chatRooms since those are not people. @@ -703,7 +707,7 @@ function getNewChatOptions( betas, searchValue: searchValue.trim(), selectedOptions, - excludeDefaultRooms: true, + excludeChatRooms: true, includeRecentReports: true, includePersonalDetails: true, maxRecentReportsToShow: 5, diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index e8ebd17d4110..ced4faa2bca6 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -159,7 +159,11 @@ class ReportScreen extends React.Component { return null; } - if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isChatRoom(this.props.report)) { + if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report)) { + return null; + } + + if (!Permissions.canUsePolicyRooms(this.props.betas) && ReportUtils.isUserCreatedPolicyRoom(this.props.report)) { return null; } diff --git a/src/pages/workspace/WorkspaceNewRoomPage.js b/src/pages/workspace/WorkspaceNewRoomPage.js index 6aec1b883eb3..5740c74ae2e4 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.js +++ b/src/pages/workspace/WorkspaceNewRoomPage.js @@ -137,8 +137,8 @@ class WorkspaceNewRoomPage extends React.Component { } render() { - if (!Permissions.canUseDefaultRooms(this.props.betas)) { - Log.info('Not showing create Policy Room page since user is not on default rooms beta'); + if (!Permissions.canUsePolicyRooms(this.props.betas)) { + Log.info('Not showing create Policy Room page since user is not on policy rooms beta'); Navigation.dismissModal(); return null; }