Skip to content

Commit

Permalink
Modify logic for deleted parent message
Browse files Browse the repository at this point in the history
  • Loading branch information
MonilBhavsar committed Feb 16, 2024
1 parent a88f89a commit e282d94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2503,6 +2503,10 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = 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) {
Expand All @@ -2518,7 +2522,7 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
if (isAdminRoom(report) || isUserCreatedPolicyRoom(report)) {
return getAdminRoomInvitedParticipants(parentReportAction, parentReportActionMessage);
}
return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');
return parentReportActionMessage;
}

if (isTaskReport(report) && isCanceledTaskReport(report, parentReportAction)) {
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/ReportAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e282d94

Please sign in to comment.