Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ const CONST = {
TASKS: 'tasks',
THREADS: 'threads',
CUSTOM_STATUS: 'customStatus',
NEW_DOT_TAGS: 'newDotTags',
NEW_DOT_SAML: 'newDotSAML',
PDF_META_STORE: 'pdfMetaStore',
REPORT_ACTION_CONTEXT_MENU: 'reportActionContextMenu',
Expand Down
13 changes: 2 additions & 11 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Log from '@libs/Log';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Permissions from '@libs/Permissions';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReceiptUtils from '@libs/ReceiptUtils';
import * as ReportUtils from '@libs/ReportUtils';
Expand Down Expand Up @@ -110,9 +109,6 @@ const propTypes = {
email: PropTypes.string.isRequired,
}),

/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),

/** The policyID of the request */
policyID: PropTypes.string,

Expand Down Expand Up @@ -188,7 +184,6 @@ const defaultProps = {
session: {
email: null,
},
betas: [],
policyID: '',
reportID: '',
...withCurrentUserPersonalDetailsDefaultProps,
Expand Down Expand Up @@ -241,12 +236,11 @@ function MoneyRequestConfirmationList(props) {
const policyTag = PolicyUtils.getTag(props.policyTags);
const policyTagList = lodashGet(policyTag, 'tags', {});
const policyTagListName = lodashGet(policyTag, 'name', translate('common.tag'));
const canUseTags = Permissions.canUseTags(props.betas);
// A flag for showing the tags field
const shouldShowTags = props.isPolicyExpenseChat && canUseTags && OptionsListUtils.hasEnabledOptions(_.values(policyTagList));
const shouldShowTags = props.isPolicyExpenseChat && OptionsListUtils.hasEnabledOptions(_.values(policyTagList));

// A flag for showing the billable field
const shouldShowBillable = canUseTags && !lodashGet(props.policy, 'disabledFields.defaultBillable', true);
const shouldShowBillable = !lodashGet(props.policy, 'disabledFields.defaultBillable', true);

const hasRoute = TransactionUtils.hasRoute(transaction);
const isDistanceRequestWithoutRoute = props.isDistanceRequest && !hasRoute;
Expand Down Expand Up @@ -745,9 +739,6 @@ export default compose(
session: {
key: ONYXKEYS.SESSION,
},
betas: {
key: ONYXKEYS.BETAS,
},
policyCategories: {
key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,
},
Expand Down
14 changes: 3 additions & 11 deletions src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import compose from '@libs/compose';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Permissions from '@libs/Permissions';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReceiptUtils from '@libs/ReceiptUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
Expand All @@ -47,9 +46,6 @@ const propTypes = {
shouldShowHorizontalRule: PropTypes.bool.isRequired,

/* Onyx Props */
/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),

/** The expense report or iou report (only will have a value if this is a transaction thread) */
parentReport: iouReportPropTypes,

Expand All @@ -66,7 +62,6 @@ const propTypes = {
};

const defaultProps = {
betas: [],
parentReport: {},
policyCategories: {},
transaction: {
Expand All @@ -77,7 +72,7 @@ const defaultProps = {
policyTags: {},
};

function MoneyRequestView({report, betas, parentReport, policyCategories, shouldShowHorizontalRule, transaction, policyTags, policy}) {
function MoneyRequestView({report, parentReport, policyCategories, shouldShowHorizontalRule, transaction, policyTags, policy}) {
const {isSmallScreenWidth} = useWindowDimensions();
const {translate} = useLocalize();
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
Expand Down Expand Up @@ -120,8 +115,8 @@ function MoneyRequestView({report, betas, parentReport, policyCategories, should

// Flags for showing categories and tags
const shouldShowCategory = isPolicyExpenseChat && (transactionCategory || OptionsListUtils.hasEnabledOptions(lodashValues(policyCategories)));
const shouldShowTag = isPolicyExpenseChat && Permissions.canUseTags(betas) && (transactionTag || OptionsListUtils.hasEnabledOptions(lodashValues(policyTagsList)));
const shouldShowBillable = isPolicyExpenseChat && Permissions.canUseTags(betas) && (transactionBillable || !lodashGet(policy, 'disabledFields.defaultBillable', true));
const shouldShowTag = isPolicyExpenseChat && (transactionTag || OptionsListUtils.hasEnabledOptions(lodashValues(policyTagsList)));
const shouldShowBillable = isPolicyExpenseChat && (transactionBillable || !lodashGet(policy, 'disabledFields.defaultBillable', true));

let amountDescription = `${translate('iou.amount')}`;

Expand Down Expand Up @@ -301,9 +296,6 @@ MoneyRequestView.displayName = 'MoneyRequestView';
export default compose(
withCurrentUserPersonalDetails,
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
parentReport: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`,
},
Expand Down
5 changes: 0 additions & 5 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ function canUseCustomStatus(betas: Beta[]): boolean {
return betas?.includes(CONST.BETAS.CUSTOM_STATUS) || canUseAllBetas(betas);
}

function canUseTags(betas: Beta[]): boolean {
return betas?.includes(CONST.BETAS.NEW_DOT_TAGS) || canUseAllBetas(betas);
}

function canUseViolations(betas: Beta[]): boolean {
return betas?.includes(CONST.BETAS.VIOLATIONS) || canUseAllBetas(betas);
}
Expand All @@ -66,7 +62,6 @@ export default {
canUsePolicyRooms,
canUseTasks,
canUseCustomStatus,
canUseTags,
canUseLinkPreviews,
canUseViolations,
};
12 changes: 2 additions & 10 deletions src/pages/EditRequestPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import compose from '@libs/compose';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Permissions from '@libs/Permissions';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
Expand Down Expand Up @@ -45,9 +44,6 @@ const propTypes = {
}).isRequired,

/** Onyx props */
/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),

/** The report object for the thread report */
report: reportPropTypes,

Expand All @@ -68,7 +64,6 @@ const propTypes = {
};

const defaultProps = {
betas: [],
report: {},
parentReport: {},
policyCategories: {},
Expand All @@ -77,7 +72,7 @@ const defaultProps = {
transaction: {},
};

function EditRequestPage({betas, report, route, parentReport, policyCategories, policyTags, parentReportActions, transaction}) {
function EditRequestPage({report, route, parentReport, policyCategories, policyTags, parentReportActions, transaction}) {
const parentReportActionID = lodashGet(report, 'parentReportActionID', '0');
const parentReportAction = lodashGet(parentReportActions, parentReportActionID, {});
const {
Expand Down Expand Up @@ -107,7 +102,7 @@ function EditRequestPage({betas, report, route, parentReport, policyCategories,
const shouldShowCategories = isPolicyExpenseChat && (transactionCategory || OptionsListUtils.hasEnabledOptions(lodashValues(policyCategories)));

// A flag for showing the tags page
const shouldShowTags = isPolicyExpenseChat && Permissions.canUseTags(betas) && (transactionTag || OptionsListUtils.hasEnabledOptions(lodashValues(policyTagList)));
const shouldShowTags = isPolicyExpenseChat && (transactionTag || OptionsListUtils.hasEnabledOptions(lodashValues(policyTagList)));

// Decides whether to allow or disallow editing a money request
useEffect(() => {
Expand Down Expand Up @@ -278,9 +273,6 @@ EditRequestPage.propTypes = propTypes;
EditRequestPage.defaultProps = defaultProps;
export default compose(
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
report: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`,
},
Expand Down