Skip to content

Commit

Permalink
Merge pull request #9291 from Expensify/amal-decouple-betas-default-p…
Browse files Browse the repository at this point in the history
…olicy

Decouple policyRoom and defaultRoom betas
  • Loading branch information
ctkochan22 authored Jun 3, 2022
2 parents 1359bf5 + e22e97b commit 994841f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function getOptions(reports, personalDetails, activeReportID, {
selectedOptions = [],
maxRecentReportsToShow = 0,
excludeLogins = [],
excludeDefaultRooms = false,
excludeChatRooms = false,
includeMultipleParticipantReports = false,
includePersonalDetails = false,
includeRecentReports = false,
Expand Down Expand Up @@ -439,18 +439,22 @@ 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;
}

if (ReportUtils.isUserCreatedPolicyRoom(report) && !Permissions.canUsePolicyRooms(betas)) {
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.
Expand Down Expand Up @@ -703,7 +707,7 @@ function getNewChatOptions(
betas,
searchValue: searchValue.trim(),
selectedOptions,
excludeDefaultRooms: true,
excludeChatRooms: true,
includeRecentReports: true,
includePersonalDetails: true,
maxRecentReportsToShow: 5,
Expand Down
6 changes: 5 additions & 1 deletion src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceNewRoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 994841f

Please sign in to comment.