Skip to content
Merged
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
48 changes: 44 additions & 4 deletions src/pages/ReportDetailsPage.tsx

Copy link
Copy Markdown
Contributor

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.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -371,6 +375,42 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) {
});
}

if (isTrackExpenseReport) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check caused the following issue:

because it didn't account for !isDeletedParentAction, which was fixed in PR #52786.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each item should have a unique key to avoid such bug.
More info:
#57531 (comment)

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({
Expand Down Expand Up @@ -517,6 +557,10 @@ function ReportDetailsPage({policies, report, route}: ReportDetailsPageProps) {
isExpenseReport,
backTo,
canActionTask,
isTrackExpenseReport,
iouTransactionID,
parentReportAction,
moneyRequestReport?.reportID,
]);

const displayNamesWithTooltips = useMemo(() => {
Expand Down Expand Up @@ -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 &&
Expand Down