Skip to content

Commit

Permalink
Merge pull request #40358 from Expensify/tgolen-useproperactionresolu…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
blimpich authored Apr 18, 2024
2 parents 99b736e + 2a01d46 commit 816ed6b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ const CONST = {
ACTION: {
EDIT: 'edit',
CREATE: 'create',
MOVE: 'move',
REQUEST: 'request',
CATEGORIZE: 'categorize',
SHARE: 'share',
},
Expand All @@ -1436,7 +1436,6 @@ const CONST = {
DELETE: 'delete',
APPROVE: 'approve',
TRACK: 'track',
MOVE: 'move',
},
AMOUNT_MAX_LENGTH: 10,
RECEIPT_STATE: {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Navigation from './Navigation/Navigation';
import * as TransactionUtils from './TransactionUtils';

function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: IOUType, transactionID: string, reportID: string, iouAction?: IOUAction): void {
if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.MOVE) {
if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.REQUEST) {
Navigation.goBack();
return;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ function insertTagIntoTransactionTagsString(transactionTags: string, tag: string
}

function isMovingTransactionFromTrackExpense(action?: IOUAction) {
if (action === CONST.IOU.ACTION.MOVE || action === CONST.IOU.ACTION.SHARE || action === CONST.IOU.ACTION.CATEGORIZE) {
if (action === CONST.IOU.ACTION.REQUEST || action === CONST.IOU.ACTION.SHARE || action === CONST.IOU.ACTION.CATEGORIZE) {
return true;
}

Expand Down
8 changes: 6 additions & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,7 @@ const getConvertTrackedExpenseInformation = (
linkedTrackedExpenseReportAction: OnyxTypes.ReportAction,
linkedTrackedExpenseReportID: string,
transactionThreadReportID: string,
resolution: IOUAction,
) => {
const optimisticData: OnyxUpdate[] = [];
const successData: OnyxUpdate[] = [];
Expand Down Expand Up @@ -2540,7 +2541,7 @@ const getConvertTrackedExpenseInformation = (
value: {
[actionableWhisperReportActionID]: {
originalMessage: {
resolution: CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING,
resolution,
},
},
},
Expand Down Expand Up @@ -2596,6 +2597,7 @@ function convertTrackedExpenseToRequest(
linkedTrackedExpenseReportAction,
linkedTrackedExpenseReportID,
transactionThreadReportID,
CONST.IOU.ACTION.REQUEST,
);

optimisticData?.push(...moveTransactionOptimisticData);
Expand Down Expand Up @@ -2662,6 +2664,7 @@ function categorizeTrackedExpense(
linkedTrackedExpenseReportAction,
linkedTrackedExpenseReportID,
transactionThreadReportID,
CONST.IOU.ACTION.CATEGORIZE,
);

optimisticData?.push(...moveTransactionOptimisticData);
Expand Down Expand Up @@ -2731,6 +2734,7 @@ function shareTrackedExpense(
linkedTrackedExpenseReportAction,
linkedTrackedExpenseReportID,
transactionThreadReportID,
CONST.IOU.ACTION.SHARE,
);

optimisticData?.push(...moveTransactionOptimisticData);
Expand Down Expand Up @@ -2834,7 +2838,7 @@ function requestMoney(
const activeReportID = isMoneyRequestReport ? report?.reportID : chatReport.reportID;

switch (action) {
case CONST.IOU.ACTION.MOVE: {
case CONST.IOU.ACTION.REQUEST: {
if (!linkedTrackedExpenseReportAction || !actionableWhisperReportActionID || !linkedTrackedExpenseReportID) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function ReportActionItem({
text: 'actionableMentionTrackExpense.submit',
key: `${action.reportActionID}-actionableMentionTrackExpense-submit`,
onPress: () => {
ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID, report.reportID, CONST.IOU.ACTION.MOVE, action.reportActionID);
ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID, report.reportID, CONST.IOU.ACTION.REQUEST, action.reportActionID);
},
isMediumSized: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF

// If we are using this component in the "Submit expense" 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.REQUEST && action !== CONST.IOU.ACTION.MOVE,
iouType === CONST.IOU.TYPE.REQUEST && action !== CONST.IOU.ACTION.REQUEST,

(canUseP2PDistanceRequests || iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) && ![CONST.IOU.ACTION.CATEGORIZE, CONST.IOU.ACTION.SHARE].includes(action),
false,
Expand Down Expand Up @@ -267,7 +267,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF
(canUseP2PDistanceRequests || iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) &&
iouType !== CONST.IOU.TYPE.SEND &&
iouType !== CONST.IOU.TYPE.TRACK_EXPENSE &&
![CONST.IOU.ACTION.SHARE, CONST.IOU.ACTION.MOVE, CONST.IOU.ACTION.CATEGORIZE].includes(action);
![CONST.IOU.ACTION.SHARE, CONST.IOU.ACTION.REQUEST, CONST.IOU.ACTION.CATEGORIZE].includes(action);

const handleConfirmSelection = useCallback(
(keyEvent, option) => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function IOURequestStepConfirmation({
const transactionTaxAmount = transaction?.taxAmount;
const isSharingTrackExpense = action === CONST.IOU.ACTION.SHARE;
const isCategorizingTrackExpense = action === CONST.IOU.ACTION.CATEGORIZE;
const isRequestingFromTrackExpense = action === CONST.IOU.ACTION.MOVE;
const isRequestingFromTrackExpense = action === CONST.IOU.ACTION.REQUEST;

const requestType = TransactionUtils.getRequestType(transaction);

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 @@ -48,7 +48,7 @@ function IOURequestStepParticipants({
if (action === CONST.IOU.ACTION.CATEGORIZE) {
return translate('iou.categorize');
}
if (action === CONST.IOU.ACTION.MOVE) {
if (action === CONST.IOU.ACTION.REQUEST) {
return translate('iou.submitExpense');
}
if (action === CONST.IOU.ACTION.SHARE) {
Expand Down

0 comments on commit 816ed6b

Please sign in to comment.