Skip to content

Commit

Permalink
Merge pull request #5495 from Expensify/revert-5485-ionatan_addbeta_f…
Browse files Browse the repository at this point in the history
…reeplansoftlaunch

Revert "Moves all free plan beta checks to use free plan soft launch beta"

(cherry picked from commit c75955f)
  • Loading branch information
Jag96 authored and OSBotify committed Sep 24, 2021
1 parent 97d3482 commit a1f594b
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const CONST = {
IOU: 'IOU',
PAY_WITH_EXPENSIFY: 'payWithExpensify',
FREE_PLAN: 'freePlan',
FREE_PLAN_SOFT_LAUNCH: 'freePlanSoftLaunch',
DEFAULT_ROOMS: 'defaultRooms',
BETA_EXPENSIFY_WALLET: 'expensifyWallet',
INTERNATIONALIZATION: 'internationalization',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ let hasLoadedPolicies = false;
function loadPoliciesBehindBeta(betas) {
// When removing the freePlan beta, simply load the policyList and the policySummaries in componentDidMount().
// Policy info loading should not be blocked behind the defaultRooms beta alone.
if (!hasLoadedPolicies && (Permissions.canUseFreePlanSoftLaunch(betas) || Permissions.canUseDefaultRooms(betas))) {
if (!hasLoadedPolicies && (Permissions.canUseFreePlan(betas) || Permissions.canUseDefaultRooms(betas))) {
getPolicyList();
getPolicySummaries();
hasLoadedPolicies = true;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function isActiveRoute(routePath) {
*
* Example:
* ```jsx
* if (!Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
* if (!Permissions.canUseFreePlan(this.props.betas)) {
* return <Navigation.DismissModal />;
* }
* ```
Expand Down
9 changes: 0 additions & 9 deletions src/libs/Permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ function canUseFreePlan(betas) {
return _.contains(betas, CONST.BETAS.FREE_PLAN) || canUseAllBetas(betas);
}

/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseFreePlanSoftLaunch(betas) {
return _.contains(betas, CONST.BETAS.FREE_PLAN_SOFT_LAUNCH) || canUseAllBetas(betas);
}

/**
* @param {Array<String>} betas
* @returns {Boolean}
Expand Down Expand Up @@ -80,7 +72,6 @@ export default {
canUseIOU,
canUsePayWithExpensify,
canUseFreePlan,
canUseFreePlanSoftLaunch,
canUseDefaultRooms,
canUseInternationalization,
canUseWallet,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LoginWithValidateCode2FAPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ class LoginWithValidateCode2FAPage extends Component {
// and by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/`
// if they cancel out of the new workspace modal.
Navigation.dismissModal();
if (Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (Permissions.canUseFreePlan(this.props.betas)) {
this.rerouteToRelevantPage();
}
}
}

componentDidUpdate() {
// Betas can be loaded a little after a user is authenticated, so check again if the betas have been updated
if (this.props.session.authToken && Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (this.props.session.authToken && Permissions.canUseFreePlan(this.props.betas)) {
this.rerouteToRelevantPage();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LoginWithValidateCodePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LoginWithValidateCodePage extends Component {
// and by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/`
// if they cancel out of the new workspace modal.
Navigation.dismissModal();
if (Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (Permissions.canUseFreePlan(this.props.betas)) {
this.rerouteToRelevantPage();
}
return;
Expand All @@ -60,7 +60,7 @@ class LoginWithValidateCodePage extends Component {

componentDidUpdate() {
// Betas can be loaded a little after a user is authenticated, so check again if the betas have been updated
if (this.props.session.authToken && Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (this.props.session.authToken && Permissions.canUseFreePlan(this.props.betas)) {
this.rerouteToRelevantPage();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ReimbursementAccountPage extends React.Component {
}

render() {
if (!Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (!Permissions.canUseFreePlan(this.props.betas)) {
console.debug('Not showing new bank account page because user is not on free plan beta');
Navigation.dismissModal();
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class SidebarScreen extends Component {
onSelected: () => Navigation.navigate(ROUTES.IOU_BILL),
},
] : []),
...(Permissions.canUseFreePlanSoftLaunch(this.props.betas) && !isAdminOfFreePolicy(this.props.allPolicies) ? [
...(Permissions.canUseFreePlan(this.props.betas) && !isAdminOfFreePolicy(this.props.allPolicies) ? [
{
icon: NewWorkspace,
iconWidth: 46,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const WorkspaceCardPage = ({
}
};

if (!Permissions.canUseFreePlanSoftLaunch(betas)) {
if (!Permissions.canUseFreePlan(betas)) {
console.debug('Not showing workspace card page because user is not on free plan beta');
return <Navigation.DismissModal />;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceEditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class WorkspaceEditorPage extends React.Component {
render() {
const {policy} = this.props;

if (!Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (!Permissions.canUseFreePlan(this.props.betas)) {
console.debug('Not showing workspace editor page because user is not on free plan beta');
return <Navigation.DismissModal />;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspacePeoplePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class WorkspacePeoplePage extends React.Component {
}

render() {
if (!Permissions.canUseFreePlanSoftLaunch(this.props.betas)) {
if (!Permissions.canUseFreePlan(this.props.betas)) {
console.debug('Not showing workspace people page because user is not on free plan beta');
return <Navigation.DismissModal />;
}
Expand Down

0 comments on commit a1f594b

Please sign in to comment.