Skip to content
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

Display deleted request in transaction thread report #36557

Merged
merged 4 commits into from
Feb 20, 2024
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
38 changes: 31 additions & 7 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,28 @@ function ReportActionItem(props) {
if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
const parentReportAction = props.parentReportActions[props.report.parentReportActionID];
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
const isReversedTransaction = ReportActionsUtils.isReversedTransaction(parentReportAction);
if (ReportActionsUtils.isDeletedParentAction(parentReportAction) || isReversedTransaction) {
return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth, true), styles.justifyContentEnd]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}>
<OfflineWithFeedback pendingAction={lodashGet(parentReportAction, 'pendingAction', null)}>
<ReportActionItemSingle
action={parentReportAction}
showHeader
report={props.report}
>
<RenderHTML
html={`<comment>${props.translate(isReversedTransaction ? 'parentReportAction.reversedTransaction' : 'parentReportAction.deletedRequest')}</comment>`}
/>
</ReportActionItemSingle>
<View style={styles.threadDividerLine} />
</OfflineWithFeedback>
</View>
</View>
);
}
return (
<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
Expand All @@ -639,7 +661,7 @@ function ReportActionItem(props) {
if (ReportUtils.isTaskReport(props.report)) {
if (ReportUtils.isCanceledTaskReport(props.report, parentReportAction)) {
return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth, true)]}>
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}>
<ReportActionItemSingle
Expand All @@ -649,7 +671,6 @@ function ReportActionItem(props) {
>
<RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />
</ReportActionItemSingle>
<View style={styles.reportHorizontalRule} />
</View>
</View>
);
Expand Down Expand Up @@ -857,9 +878,10 @@ export default compose(
},
}),
)(
memo(
ReportActionItem,
(prevProps, nextProps) =>
memo(ReportActionItem, (prevProps, nextProps) => {
const prevParentReportAction = prevProps.parentReportActions[prevProps.report.parentReportActionID];
const nextParentReportAction = nextProps.parentReportActions[nextProps.report.parentReportActionID];
return (
prevProps.displayAsGroup === nextProps.displayAsGroup &&
prevProps.draftMessage === nextProps.draftMessage &&
prevProps.isMostRecentIOUReportAction === nextProps.isMostRecentIOUReportAction &&
Expand Down Expand Up @@ -888,6 +910,8 @@ export default compose(
prevProps.linkedReportActionID === nextProps.linkedReportActionID &&
_.isEqual(prevProps.policyReportFields, nextProps.policyReportFields) &&
_.isEqual(prevProps.report.reportFields, nextProps.report.reportFields) &&
_.isEqual(prevProps.policy, nextProps.policy),
),
_.isEqual(prevProps.policy, nextProps.policy) &&
_.isEqual(prevParentReportAction, nextParentReportAction)
);
}),
);
Loading