From ed3b9e9a6ddf400b072e334ea28f92a4aa213fb7 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 29 Jun 2022 20:51:29 -0700 Subject: [PATCH 1/4] Revert "Add exception for default rooms beta for users who are members of a free policy" --- .../AppNavigator/MainDrawerNavigator.js | 35 +++---------------- src/libs/OptionsListUtils.js | 10 +----- src/libs/PolicyUtils.js | 30 ---------------- src/libs/ReportUtils.js | 9 +++-- src/libs/actions/Policy.js | 13 +++++++ src/libs/actions/Welcome.js | 4 +-- src/pages/home/ReportScreen.js | 22 +----------- .../SidebarScreen/BaseSidebarScreen.js | 3 +- 8 files changed, 26 insertions(+), 100 deletions(-) delete mode 100644 src/libs/PolicyUtils.js diff --git a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js index 3f966d71e6bb..5201453768c9 100644 --- a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js @@ -13,8 +13,6 @@ import ReportScreen from '../../../pages/home/ReportScreen'; import SidebarScreen from '../../../pages/home/sidebar/SidebarScreen'; import BaseDrawerNavigator from './BaseDrawerNavigator'; import * as ReportUtils from '../../ReportUtils'; -import * as PolicyUtils from '../../PolicyUtils'; -import CONST from '../../../CONST'; const propTypes = { /** Available reports that would be displayed in this navigator */ @@ -24,15 +22,6 @@ const propTypes = { /** Beta features list */ betas: PropTypes.arrayOf(PropTypes.string), - - /** The policies which the user has access to */ - policies: PropTypes.objectOf(PropTypes.shape({ - /** The policy name */ - name: PropTypes.string, - - /** The type of the policy */ - type: PropTypes.string, - })).isRequired, }; const defaultProps = { @@ -44,11 +33,11 @@ const defaultProps = { * Get the most recently accessed report for the user * * @param {Object} reports - * @param {String[]} [reportTypesToIgnore] + * @param {Boolean} [ignoreDefaultRooms] * @returns {Object} */ -const getInitialReportScreenParams = (reports, reportTypesToIgnore) => { - const last = ReportUtils.findLastAccessedReport(reports, reportTypesToIgnore); +const getInitialReportScreenParams = (reports, ignoreDefaultRooms) => { + const last = ReportUtils.findLastAccessedReport(reports, ignoreDefaultRooms); // Fallback to empty if for some reason reportID cannot be derived - prevents the app from crashing const reportID = lodashGet(last, 'reportID', ''); @@ -56,20 +45,7 @@ const getInitialReportScreenParams = (reports, reportTypesToIgnore) => { }; const MainDrawerNavigator = (props) => { - // If one is a member of a free policy, then they are allowed to see the Policy default rooms. - // For everyone else, one must be on the beta to see a default room. - let reportTypesToIgnore = []; - const isMemberOfFreePolicy = PolicyUtils.isMemberOfFreePolicy(props.policies); - if (isMemberOfFreePolicy && !Permissions.canUseDefaultRooms(props.betas)) { - reportTypesToIgnore = [CONST.REPORT.CHAT_TYPE.DOMAIN_ALL]; - } else if (!Permissions.canUseDefaultRooms(props.betas)) { - reportTypesToIgnore = [ - CONST.REPORT.CHAT_TYPE.POLICY_ADMINS, - CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, - CONST.REPORT.CHAT_TYPE.DOMAIN_ALL, - ]; - } - const initialParams = getInitialReportScreenParams(props.reports, reportTypesToIgnore); + const initialParams = getInitialReportScreenParams(props.reports, !Permissions.canUseDefaultRooms(props.betas)); // Wait until reports are fetched and there is a reportID in initialParams if (!initialParams.reportID) { @@ -105,8 +81,5 @@ export default withOnyx({ betas: { key: ONYXKEYS.BETAS, }, - policies: { - key: ONYXKEYS.COLLECTION.POLICY, - }, })(MainDrawerNavigator); export {getInitialReportScreenParams}; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index a3c39f4235be..da16be11ca63 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -10,7 +10,6 @@ import * as ReportUtils from './ReportUtils'; import * as Localize from './Localize'; import Permissions from './Permissions'; import * as CollectionUtils from './CollectionUtils'; -import * as PolicyUtils from './PolicyUtils'; /** * OptionsListUtils is used to build a list options passed to the OptionsList component. Several different UI views can @@ -441,14 +440,7 @@ function getOptions(reports, personalDetails, activeReportID, { return; } - // If one is a member of a free policy, then they are allowed to see the Policy default rooms. - // For everyone else, one must be on the beta to see a default room. - const isMemberOfFreePolicy = PolicyUtils.isMemberOfFreePolicy(policies); - if (isMemberOfFreePolicy && !Permissions.canUseDefaultRooms(betas)) { - if (ReportUtils.isDomainRoom(report)) { - return; - } - } else if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas)) { + if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas)) { return; } diff --git a/src/libs/PolicyUtils.js b/src/libs/PolicyUtils.js deleted file mode 100644 index d225fd1982b7..000000000000 --- a/src/libs/PolicyUtils.js +++ /dev/null @@ -1,30 +0,0 @@ -import _ from 'underscore'; -import CONST from '../CONST'; - -/** - * Is the user an admin of a free policy (aka workspace)? - * - * @param {Array} policies - * @returns {Boolean} - */ -function isAdminOfFreePolicy(policies) { - return _.some(policies, policy => policy - && policy.type === CONST.POLICY.TYPE.FREE - && policy.role === CONST.POLICY.ROLE.ADMIN); -} - -/** - * Is the user a member of a free policy (aka workspace)? - * - * @param {Array} policies - * @returns {Boolean} - */ -function isMemberOfFreePolicy(policies) { - return _.some(policies, policy => policy - && policy.type === CONST.POLICY.TYPE.FREE); -} - -export { - isAdminOfFreePolicy, - isMemberOfFreePolicy, -}; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 1547c358b497..0a47f9693fe3 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -171,14 +171,14 @@ function isChatRoom(report) { * Given a collection of reports returns the most recently accessed one * * @param {Record|Array<{lastVisitedTimestamp, reportID}>} reports - * @param {String[]} [reportTypesToIgnore] + * @param {Boolean} [ignoreDefaultRooms] * @returns {Object} */ -function findLastAccessedReport(reports, reportTypesToIgnore) { +function findLastAccessedReport(reports, ignoreDefaultRooms) { let sortedReports = sortReportsByLastVisited(reports); - if (reportTypesToIgnore) { - sortedReports = _.filter(sortedReports, report => !_.contains(reportTypesToIgnore, lodashGet(report, ['chatType'], ''))); + if (ignoreDefaultRooms) { + sortedReports = _.filter(sortedReports, report => !isDefaultRoom(report)); } return _.last(sortedReports); @@ -512,7 +512,6 @@ export { isDefaultRoom, isAdminRoom, isAnnounceRoom, - isDomainRoom, isUserCreatedPolicyRoom, isChatRoom, getChatRoomSubtitle, diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index ab522704268a..aa037a5cf692 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -267,6 +267,18 @@ function loadFullPolicy(policyID) { }); } +/** + * Is the user an admin of a free policy (aka workspace)? + * + * @param {Array} policies + * @returns {Boolean} + */ +function isAdminOfFreePolicy(policies) { + return _.some(policies, policy => policy + && policy.type === CONST.POLICY.TYPE.FREE + && policy.role === CONST.POLICY.ROLE.ADMIN); +} + /** * Remove the passed members from the policy employeeList * @@ -538,6 +550,7 @@ export { loadFullPolicy, removeMembers, invite, + isAdminOfFreePolicy, create, uploadAvatar, update, diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 0d2eeadff248..41c559093941 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -4,11 +4,11 @@ import lodashGet from 'lodash/get'; import Navigation from '../Navigation/Navigation'; import * as ReportUtils from '../ReportUtils'; import ROUTES from '../../ROUTES'; +import * as Policy from './Policy'; import ONYXKEYS from '../../ONYXKEYS'; import NameValuePair from './NameValuePair'; import CONST from '../../CONST'; import SCREENS from '../../SCREENS'; -import * as PolicyUtils from '../PolicyUtils'; let resolveIsReadyPromise; let isReadyPromise = new Promise((resolve) => { @@ -130,7 +130,7 @@ function show({routes, showCreateMenu}) { // If user is not already an admin of a free policy and we are not navigating them to their workspace or creating a new workspace via workspace/new then // we will show the create menu. - if (!PolicyUtils.isAdminOfFreePolicy(allPolicies) && !isDisplayingWorkspaceRoute) { + if (!Policy.isAdminOfFreePolicy(allPolicies) && !isDisplayingWorkspaceRoute) { showCreateMenu(); } }); diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 4b4faa4d7013..5d32a341c725 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -23,7 +23,6 @@ import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndica import reportActionPropTypes from './report/reportActionPropTypes'; import ArchivedReportFooter from '../../components/ArchivedReportFooter'; import toggleReportActionComposeView from '../../libs/toggleReportActionComposeView'; -import * as PolicyUtils from '../../libs/PolicyUtils'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -66,15 +65,6 @@ const propTypes = { /** Beta features list */ betas: PropTypes.arrayOf(PropTypes.string), - - /** The policies which the user has access to */ - policies: PropTypes.objectOf(PropTypes.shape({ - /** The policy name */ - name: PropTypes.string, - - /** The type of the policy */ - type: PropTypes.string, - })).isRequired, }; const defaultProps = { @@ -195,14 +185,7 @@ class ReportScreen extends React.Component { return null; } - // If one is a member of a free policy, then they are allowed to see the Policy default rooms. - // For everyone else, one must be on the beta to see a default room. - const isMemberOfFreePolicy = PolicyUtils.isMemberOfFreePolicy(this.props.policies); - if (isMemberOfFreePolicy && !Permissions.canUseDefaultRooms(this.props.betas)) { - if (ReportUtils.isDomainRoom(this.props.report)) { - return null; - } - } else if (ReportUtils.isDefaultRoom(this.props.report) && !Permissions.canUseDefaultRooms(this.props.betas)) { + if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report)) { return null; } @@ -293,7 +276,4 @@ export default withOnyx({ betas: { key: ONYXKEYS.BETAS, }, - policies: { - key: ONYXKEYS.COLLECTION.POLICY, - }, })(ReportScreen); diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js index f1b77faf5736..a939c5bf4e19 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js @@ -18,7 +18,6 @@ import * as Policy from '../../../../libs/actions/Policy'; import Performance from '../../../../libs/Performance'; import * as Welcome from '../../../../libs/actions/Welcome'; import {sidebarPropTypes, sidebarDefaultProps} from './sidebarPropTypes'; -import * as PolicyUtils from '../../../../libs/PolicyUtils'; const propTypes = { @@ -164,7 +163,7 @@ class BaseSidebarScreen extends Component { onSelected: () => Navigation.navigate(ROUTES.IOU_BILL), }, ] : []), - ...(!this.props.isCreatingWorkspace && !PolicyUtils.isAdminOfFreePolicy(this.props.allPolicies) ? [ + ...(!this.props.isCreatingWorkspace && !Policy.isAdminOfFreePolicy(this.props.allPolicies) ? [ { icon: Expensicons.NewWorkspace, iconWidth: 46, From 0bdb3230cad4594d2e83007b268d204d86792bdf Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 29 Jun 2022 21:01:46 -0700 Subject: [PATCH 2/4] Ignore all default rooms that belong to a FREE type policy --- .../AppNavigator/MainDrawerNavigator.js | 18 +++++++++++++++--- src/libs/OptionsListUtils.js | 2 +- src/libs/ReportUtils.js | 16 ++++++++++++++-- src/pages/home/ReportScreen.js | 14 +++++++++++++- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js index 5201453768c9..3faff43957b6 100644 --- a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js @@ -22,6 +22,15 @@ const propTypes = { /** Beta features list */ betas: PropTypes.arrayOf(PropTypes.string), + + /** The policies which the user has access to */ + policies: PropTypes.objectOf(PropTypes.shape({ + /** The policy name */ + name: PropTypes.string, + + /** The type of the policy */ + type: PropTypes.string, + })).isRequired, }; const defaultProps = { @@ -36,8 +45,8 @@ const defaultProps = { * @param {Boolean} [ignoreDefaultRooms] * @returns {Object} */ -const getInitialReportScreenParams = (reports, ignoreDefaultRooms) => { - const last = ReportUtils.findLastAccessedReport(reports, ignoreDefaultRooms); +const getInitialReportScreenParams = (reports, ignoreDefaultRooms, policies) => { + const last = ReportUtils.findLastAccessedReport(reports, ignoreDefaultRooms, policies); // Fallback to empty if for some reason reportID cannot be derived - prevents the app from crashing const reportID = lodashGet(last, 'reportID', ''); @@ -45,7 +54,7 @@ const getInitialReportScreenParams = (reports, ignoreDefaultRooms) => { }; const MainDrawerNavigator = (props) => { - const initialParams = getInitialReportScreenParams(props.reports, !Permissions.canUseDefaultRooms(props.betas)); + const initialParams = getInitialReportScreenParams(props.reports, !Permissions.canUseDefaultRooms(props.betas), props.policies); // Wait until reports are fetched and there is a reportID in initialParams if (!initialParams.reportID) { @@ -81,5 +90,8 @@ export default withOnyx({ betas: { key: ONYXKEYS.BETAS, }, + policies: { + key: ONYXKEYS.COLLECTION.POLICY, + }, })(MainDrawerNavigator); export {getInitialReportScreenParams}; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index da16be11ca63..1beddc52abf7 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -440,7 +440,7 @@ function getOptions(reports, personalDetails, activeReportID, { return; } - if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas)) { + if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas) && ReportUtils.getPolicyType(report, policies) !== CONST.POLICY.TYPE.FREE) { return; } diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 0a47f9693fe3..060a708e75dd 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -174,11 +174,11 @@ function isChatRoom(report) { * @param {Boolean} [ignoreDefaultRooms] * @returns {Object} */ -function findLastAccessedReport(reports, ignoreDefaultRooms) { +function findLastAccessedReport(reports, ignoreDefaultRooms, policies) { let sortedReports = sortReportsByLastVisited(reports); if (ignoreDefaultRooms) { - sortedReports = _.filter(sortedReports, report => !isDefaultRoom(report)); + sortedReports = _.filter(sortedReports, report => !isDefaultRoom(report) || getPolicyType(report, policies) === CONST.POLICY.TYPE.FREE); } return _.last(sortedReports); @@ -213,6 +213,17 @@ function getPolicyName(report, policies) { return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'name'], defaultValue); } +/** + * Get the policy type from a given report + * @param {Object} report + * @param {String} report.policyID + * @param {Object} policies must have Onyxkey prefix (i.e 'policy_') for keys + * @returns {String} + */ +function getPolicyType(report, policies) { + return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'type'], ''); +} + /** * Get either the policyName or domainName the chat is tied to * @param {Object} report @@ -516,6 +527,7 @@ export { isChatRoom, getChatRoomSubtitle, getPolicyName, + getPolicyType, isArchivedRoom, isConciergeChatReport, hasExpensifyEmails, diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 5d32a341c725..4b4f2fd29570 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -65,6 +65,15 @@ const propTypes = { /** Beta features list */ betas: PropTypes.arrayOf(PropTypes.string), + + /** The policies which the user has access to */ + policies: PropTypes.objectOf(PropTypes.shape({ + /** The policy name */ + name: PropTypes.string, + + /** The type of the policy */ + type: PropTypes.string, + })).isRequired, }; const defaultProps = { @@ -185,7 +194,7 @@ class ReportScreen extends React.Component { return null; } - if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report)) { + if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report) && ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE) { return null; } @@ -276,4 +285,7 @@ export default withOnyx({ betas: { key: ONYXKEYS.BETAS, }, + policies: { + key: ONYXKEYS.COLLECTION.POLICY, + }, })(ReportScreen); From 44c758dac16bade93f50b23f57e6285eac7bb873 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 29 Jun 2022 21:26:59 -0700 Subject: [PATCH 3/4] JS Linting --- .../AppNavigator/MainDrawerNavigator.js | 1 + src/libs/ReportUtils.js | 23 ++++++++++--------- src/pages/home/ReportScreen.js | 4 +++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js index 3faff43957b6..cc6ef419e5ec 100644 --- a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js @@ -43,6 +43,7 @@ const defaultProps = { * * @param {Object} reports * @param {Boolean} [ignoreDefaultRooms] + * @param {Object} policies * @returns {Object} */ const getInitialReportScreenParams = (reports, ignoreDefaultRooms, policies) => { diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 060a708e75dd..3a2224d86b21 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -167,11 +167,23 @@ function isChatRoom(report) { return isUserCreatedPolicyRoom(report) || isDefaultRoom(report); } +/** + * Get the policy type from a given report + * @param {Object} report + * @param {String} report.policyID + * @param {Object} policies must have Onyxkey prefix (i.e 'policy_') for keys + * @returns {String} + */ +function getPolicyType(report, policies) { + return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'type'], ''); +} + /** * Given a collection of reports returns the most recently accessed one * * @param {Record|Array<{lastVisitedTimestamp, reportID}>} reports * @param {Boolean} [ignoreDefaultRooms] + * @param {Object} policies * @returns {Object} */ function findLastAccessedReport(reports, ignoreDefaultRooms, policies) { @@ -213,17 +225,6 @@ function getPolicyName(report, policies) { return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'name'], defaultValue); } -/** - * Get the policy type from a given report - * @param {Object} report - * @param {String} report.policyID - * @param {Object} policies must have Onyxkey prefix (i.e 'policy_') for keys - * @returns {String} - */ -function getPolicyType(report, policies) { - return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'type'], ''); -} - /** * Get either the policyName or domainName the chat is tied to * @param {Object} report diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 4b4f2fd29570..d43fee886646 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -194,7 +194,9 @@ class ReportScreen extends React.Component { return null; } - if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report) && ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE) { + if (!Permissions.canUseDefaultRooms(this.props.betas) + && ReportUtils.isDefaultRoom(this.props.report) + && ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE) { return null; } From f2709326f6ea2a1c68606883f8405ef18e824a60 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 29 Jun 2022 21:51:12 -0700 Subject: [PATCH 4/4] Add docs --- src/libs/OptionsListUtils.js | 1 + src/pages/home/ReportScreen.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 1beddc52abf7..53ae93cf8b74 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -440,6 +440,7 @@ function getOptions(reports, personalDetails, activeReportID, { return; } + // We let Free Plan default rooms to be shown in the App - it's the one exception to the beta, otherwise do not show policy rooms in product if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas) && ReportUtils.getPolicyType(report, policies) !== CONST.POLICY.TYPE.FREE) { return; } diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index d43fee886646..7bb33fe59abc 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -194,6 +194,7 @@ class ReportScreen extends React.Component { return null; } + // We let Free Plan default rooms to be shown in the App - it's the one exception to the beta, otherwise do not show policy rooms in product if (!Permissions.canUseDefaultRooms(this.props.betas) && ReportUtils.isDefaultRoom(this.props.report) && ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE) {