Skip to content

Commit

Permalink
Rename GLOBAL_CREATE to CREATE
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioh8010 committed Oct 1, 2024
1 parent 17b07c8 commit fcd7690
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ const CONST = {
INVOICE: 'invoice',
SUBMIT: 'submit',
TRACK: 'track',
GLOBAL_CREATE: 'create',
CREATE: 'create',
},
REQUEST_TYPE: {
DISTANCE: 'distance',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportWelcomeText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
const moneyRequestOptions = ReportUtils.temporary_getMoneyRequestOptions(report, policy, participantAccountIDs);
const additionalText = moneyRequestOptions
.filter(
(item): item is Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.GLOBAL_CREATE | typeof CONST.IOU.TYPE.INVOICE> =>
(item): item is Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE | typeof CONST.IOU.TYPE.INVOICE> =>
item !== CONST.IOU.TYPE.INVOICE,
)
.map((item) => translate(`reportActionsView.iouTypes.${item}`))
Expand Down
2 changes: 1 addition & 1 deletion src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function isValidMoneyRequestType(iouType: string): boolean {
CONST.IOU.TYPE.PAY,
CONST.IOU.TYPE.TRACK,
CONST.IOU.TYPE.INVOICE,
CONST.IOU.TYPE.GLOBAL_CREATE,
CONST.IOU.TYPE.CREATE,
];

return moneyRequestType.includes(iouType);
Expand Down
6 changes: 3 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6690,9 +6690,9 @@ function temporary_getMoneyRequestOptions(
report: OnyxEntry<Report>,
policy: OnyxEntry<Policy>,
reportParticipants: number[],
): Array<Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.GLOBAL_CREATE>> {
): Array<Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE>> {
return getMoneyRequestOptions(report, policy, reportParticipants, true) as Array<
Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.GLOBAL_CREATE>
Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE>
>;
}

Expand Down Expand Up @@ -6941,7 +6941,7 @@ function canCreateRequest(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>,

const requestOptions = getMoneyRequestOptions(report, policy, participantAccountIDs);
if (Permissions.canUseCombinedTrackSubmit(betas ?? [])) {
requestOptions.push(CONST.IOU.TYPE.GLOBAL_CREATE);
requestOptions.push(CONST.IOU.TYPE.CREATE);
}

return requestOptions.includes(iouType);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/getIconForAction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const getIconForAction = (actionType: ValueOf<typeof CONST.IOU.TYPE>) => {
return Expensicons.Cash;
case CONST.IOU.TYPE.SPLIT:
return Expensicons.Transfer;
case CONST.IOU.TYPE.GLOBAL_CREATE:
case CONST.IOU.TYPE.CREATE:
return Expensicons.Receipt;
default:
return Expensicons.MoneyCircle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';

type MoneyRequestOptions = Record<Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.GLOBAL_CREATE>, PopoverMenuItem>;
type MoneyRequestOptions = Record<Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND | typeof CONST.IOU.TYPE.CREATE>, PopoverMenuItem>;

type AttachmentPickerWithMenuItemsProps = {
/** The report currently being looked at */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ function FloatingActionButtonAndPopover(
if (canUseCombinedTrackSubmit) {
return [
{
icon: getIconForAction(CONST.IOU.TYPE.GLOBAL_CREATE),
icon: getIconForAction(CONST.IOU.TYPE.CREATE),
text: translate('iou.createExpense'),
onSelected: () =>
interceptAnonymousUser(() =>
IOU.startMoneyRequest(
CONST.IOU.TYPE.GLOBAL_CREATE,
CONST.IOU.TYPE.CREATE,
// When starting to create an expense from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
// for all of the routes in the creation flow.
ReportUtils.generateReportID(),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function IOURequestStartPage({
[CONST.IOU.TYPE.SPLIT]: translate('iou.splitExpense'),
[CONST.IOU.TYPE.TRACK]: translate('iou.trackExpense'),
[CONST.IOU.TYPE.INVOICE]: translate('workspace.invoices.sendInvoice'),
[CONST.IOU.TYPE.GLOBAL_CREATE]: translate('iou.createExpense'),
[CONST.IOU.TYPE.CREATE]: translate('iou.createExpense'),
};
const transactionRequestType = useRef(TransactionUtils.getRequestType(transaction));
const {canUseP2PDistanceRequests, canUseCombinedTrackSubmit} = usePermissions(iouType);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function MoneyRequestParticipantsSelector({

// If we are using this component in the "Submit expense" or the combined submit/track flow then we pass the includeOwnedWorkspaceChats argument so that the current user
// sees the option to submit an expense from their admin on their own Workspace Chat.
(iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.GLOBAL_CREATE || iouType === CONST.IOU.TYPE.SPLIT) && action !== CONST.IOU.ACTION.SUBMIT,
(iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.SPLIT) && action !== CONST.IOU.ACTION.SUBMIT,

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(canUseP2PDistanceRequests || iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) && !isCategorizeOrShareAction,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function IOURequestStepAmount({
// In this case, the participants can be automatically assigned from the report and the user can skip the participants step and go straight
// to the confirm step.
// If the user is started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
if (report?.reportID && !ReportUtils.isArchivedRoom(report, reportNameValuePairs) && iouType !== CONST.IOU.TYPE.GLOBAL_CREATE) {
if (report?.reportID && !ReportUtils.isArchivedRoom(report, reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {
const selectedParticipants = IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
const participants = selectedParticipants.map((participant) => {
const participantAccountID = participant?.accountID ?? -1;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepDistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function IOURequestStepDistance({
// In this case, the participants can be automatically assigned from the report and the user can skip the participants step and go straight
// to the confirm step.
// If the user started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
if (report?.reportID && !ReportUtils.isArchivedRoom(report, reportNameValuePairs) && iouType !== CONST.IOU.TYPE.GLOBAL_CREATE) {
if (report?.reportID && !ReportUtils.isArchivedRoom(report, reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {
const selectedParticipants = IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
const participants = selectedParticipants.map((participant) => {
const participantAccountID = participant?.accountID ?? -1;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function IOURequestStepParticipants({
// we will use the submit IOU type in the confirmation flow.
const iouConfirmationPageRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(
action,
iouType === CONST.IOU.TYPE.GLOBAL_CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
transactionID,
selectedReportID.current || reportID,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function IOURequestStepScan({
// If the transaction was created from the global create, the person needs to select participants, so take them there.
// If the user started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if ((transaction?.isFromGlobalCreate && iouType !== CONST.IOU.TYPE.TRACK && !report?.reportID) || iouType === CONST.IOU.TYPE.GLOBAL_CREATE) {
if ((transaction?.isFromGlobalCreate && iouType !== CONST.IOU.TYPE.TRACK && !report?.reportID) || iouType === CONST.IOU.TYPE.CREATE) {
navigateToParticipantPage();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function IOURequestStepScan({
// If the transaction was created from the global create, the person needs to select participants, so take them there.
// If the user started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if ((transaction?.isFromGlobalCreate && iouType !== CONST.IOU.TYPE.TRACK && !report?.reportID) || iouType === CONST.IOU.TYPE.GLOBAL_CREATE) {
if ((transaction?.isFromGlobalCreate && iouType !== CONST.IOU.TYPE.TRACK && !report?.reportID) || iouType === CONST.IOU.TYPE.CREATE) {
navigateToParticipantPage();
return;
}
Expand Down

0 comments on commit fcd7690

Please sign in to comment.