From e282d94531db14bc16c9bc33213db022f6d9cd5f Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 16 Feb 2024 18:19:53 +0530 Subject: [PATCH] Modify logic for deleted parent message --- src/libs/ReportUtils.ts | 6 +++++- src/types/onyx/ReportAction.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b5da21c0f67e..4990fc26746d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2503,6 +2503,10 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu return getTransactionReportName(parentReportAction); } + if (parentReportAction?.message?.[0]?.isDeletedParentAction) { + return Localize.translateLocal('parentReportAction.deletedMessage'); + } + const isAttachment = ReportActionsUtils.isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : null); const parentReportActionMessage = (parentReportAction?.message?.[0]?.text ?? '').replace(/(\r\n|\n|\r)/gm, ' '); if (isAttachment && parentReportActionMessage) { @@ -2518,7 +2522,7 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu if (isAdminRoom(report) || isUserCreatedPolicyRoom(report)) { return getAdminRoomInvitedParticipants(parentReportAction, parentReportActionMessage); } - return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage'); + return parentReportActionMessage; } if (isTaskReport(report) && isCanceledTaskReport(report, parentReportAction)) { diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 8f732a253cb5..ed3173381b32 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -41,6 +41,7 @@ type Message = { /** Fragment edited flag */ isEdited?: boolean; + /** Whether thread's parent message is deleted or not */ isDeletedParentAction?: boolean; /** Whether the pending transaction was reversed and didn't post to the card */