Repository navigation
Add Track expense follow up questions as rows in details view of a Tracked expense #51951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f9e9afd
609b704
d002395
f4334f1
969090a
c12db43
b3cf82f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,6 +298,10 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) { | |
| const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && ReportUtils.isExpenseReport(moneyRequestReport); | ||
| const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID ?? '-1'}`); | ||
|
|
||
| const iouTransactionID = ReportActionsUtils.isMoneyRequestAction(requestParentReportAction) | ||
| ? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? '' | ||
| : ''; | ||
|
|
||
| const cancelPayment = useCallback(() => { | ||
| if (!chatReport) { | ||
| return; | ||
|
|
@@ -371,6 +375,42 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) { | |
| }); | ||
| } | ||
|
|
||
| if (isTrackExpenseReport) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check caused the following issue: because it didn't account for |
||
| const actionReportID = ReportUtils.getOriginalReportID(report.reportID, parentReportAction) ?? '0'; | ||
| const whisperAction = ReportActionsUtils.getTrackExpenseActionableWhisper(iouTransactionID, moneyRequestReport?.reportID ?? '0'); | ||
| const actionableWhisperReportActionID = whisperAction?.reportActionID ?? '0'; | ||
| items.push({ | ||
| key: CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each item should have a unique key to avoid such bug. |
||
| translationKey: 'actionableMentionTrackExpense.submit', | ||
| icon: Expensicons.Send, | ||
| isAnonymousAction: false, | ||
| shouldShowRightIcon: true, | ||
| action: () => { | ||
| ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SUBMIT, actionableWhisperReportActionID); | ||
| }, | ||
| }); | ||
| items.push({ | ||
| key: CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS, | ||
| translationKey: 'actionableMentionTrackExpense.categorize', | ||
| icon: Expensicons.Folder, | ||
| isAnonymousAction: false, | ||
| shouldShowRightIcon: true, | ||
| action: () => { | ||
| ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.CATEGORIZE, actionableWhisperReportActionID); | ||
| }, | ||
| }); | ||
| items.push({ | ||
| key: CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS, | ||
| translationKey: 'actionableMentionTrackExpense.share', | ||
| icon: Expensicons.UserPlus, | ||
| isAnonymousAction: false, | ||
| shouldShowRightIcon: true, | ||
| action: () => { | ||
| ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SHARE, actionableWhisperReportActionID); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // Prevent displaying private notes option for threads and task reports | ||
| if (!isChatThread && !isMoneyRequestReport && !isInvoiceReport && !isTaskReport) { | ||
| items.push({ | ||
|
|
@@ -517,6 +557,10 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) { | |
| isExpenseReport, | ||
| backTo, | ||
| canActionTask, | ||
| isTrackExpenseReport, | ||
| iouTransactionID, | ||
| parentReportAction, | ||
| moneyRequestReport?.reportID, | ||
| ]); | ||
|
|
||
| const displayNamesWithTooltips = useMemo(() => { | ||
|
|
@@ -590,10 +634,6 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) { | |
| ); | ||
| }, [report, icons, isMoneyRequestReport, isInvoiceReport, isGroupChat, isThread, styles]); | ||
|
|
||
| const iouTransactionID = ReportActionsUtils.isMoneyRequestAction(requestParentReportAction) | ||
| ? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? '' | ||
| : ''; | ||
|
|
||
| const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(moneyRequestAction); | ||
| const shouldShowHoldAction = | ||
| caseID !== CASES.DEFAULT && | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this exposed #52239. More thorough testing on mobile might have resulted in a fix.