Skip to content

Commit

Permalink
Merge pull request Expensify#7130 from Expensify/jasper-policyRoomsBeta
Browse files Browse the repository at this point in the history
Add policy rooms to its own beta, and restrict this beta on dev
  • Loading branch information
jasperhuangg authored Jan 12, 2022
2 parents afcbb13 + bbf85bb commit 5ed23e4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const CONST = {
BETA_EXPENSIFY_WALLET: 'expensifyWallet',
INTERNATIONALIZATION: 'internationalization',
IOU_SEND: 'sendMoney',
POLICY_ROOMS: 'policyRooms',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ function getOptions(reports, personalDetails, activeReportID, {
return;
}

if (ReportUtils.isUserCreatedPolicyRoom(report) && !Permissions.canUsePolicyRooms(betas)) {
return;
}

const reportPersonalDetails = getPersonalDetailsForLogins(logins, personalDetails);

// Save the report in the map if this is a single participant so we can associate the reportID with the
Expand Down
13 changes: 13 additions & 0 deletions src/libs/Permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ function canUseWallet(betas) {
return _.contains(betas, CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas);
}

/**
* We're requiring you to be added to the policy rooms beta on dev,
* since contributors have been reporting a number of false issues related to the feature being under development.
* See https://expensify.slack.com/archives/C01GTK53T8Q/p1641921996319400?thread_ts=1641598356.166900&cid=C01GTK53T8Q
* @param {Array<String>} betas
* @returns {Boolean}
*/

function canUsePolicyRooms(betas) {
return _.contains(betas, CONST.BETAS.POLICY_ROOMS) || _.contains(betas, CONST.BETAS.ALL);
}

export default {
canUseChronos,
canUseIOU,
Expand All @@ -86,4 +98,5 @@ export default {
canUseInternationalization,
canUseIOUSend,
canUseWallet,
canUsePolicyRooms,
};
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class SidebarScreen extends Component {
text: this.props.translate('sidebarScreen.newGroup'),
onSelected: () => Navigation.navigate(ROUTES.NEW_GROUP),
},
...(Permissions.canUseDefaultRooms(this.props.betas) ? [
...(Permissions.canUsePolicyRooms(this.props.betas) ? [
{
icon: Expensicons.Hashtag,
text: this.props.translate('sidebarScreen.newRoom'),
Expand Down

0 comments on commit 5ed23e4

Please sign in to comment.