Skip to content

Commit e737f70

Browse files
authored
Merge pull request #58127 from jaydamani/lhn/update-lhn-on-delete--57694
fix(lhn): update for deleted messages
2 parents 9b14727 + e627fe2 commit e737f70

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/libs/OptionsListUtils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import {
6666
isActionOfType,
6767
isClosedAction,
6868
isCreatedTaskReportAction,
69+
isDeletedAction,
6970
isDeletedParentAction,
7071
isMarkAsClosedAction,
7172
isModifiedExpenseAction,
@@ -826,7 +827,11 @@ function getLastMessageTextForReport(
826827
}
827828

828829
// we do not want to show report closed in LHN for non archived report so use getReportLastMessage as fallback instead of lastMessageText from report
829-
if (reportID && !isArchivedReport(reportNameValuePairs) && report.lastActionType === CONST.REPORT.ACTIONS.TYPE.CLOSED) {
830+
if (
831+
reportID &&
832+
!isArchivedReport(reportNameValuePairs) &&
833+
(report.lastActionType === CONST.REPORT.ACTIONS.TYPE.CLOSED || (lastOriginalReportAction?.reportActionID && isDeletedAction(lastOriginalReportAction)))
834+
) {
830835
return lastMessageTextFromReport || (getReportLastMessage(reportID).lastMessageText ?? '');
831836
}
832837

src/libs/ReportUtils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10349,10 +10349,9 @@ function getReportLastMessage(reportID: string, actionsToMerge?: ReportActions)
1034910349
}
1035010350

1035110351
function getReportLastVisibleActionCreated(report: OnyxEntry<Report>, oneTransactionThreadReport: OnyxEntry<Report>) {
10352+
const lastVisibleReportActionCreated = getLastVisibleActionReportActionsUtils(report?.reportID)?.created ?? report?.lastVisibleActionCreated ?? '';
1035210353
const lastVisibleActionCreated =
10353-
(oneTransactionThreadReport?.lastVisibleActionCreated ?? '') > (report?.lastVisibleActionCreated ?? '')
10354-
? oneTransactionThreadReport?.lastVisibleActionCreated
10355-
: report?.lastVisibleActionCreated;
10354+
(oneTransactionThreadReport?.lastVisibleActionCreated ?? '') > lastVisibleReportActionCreated ? oneTransactionThreadReport?.lastVisibleActionCreated : lastVisibleReportActionCreated;
1035610355

1035710356
return lastVisibleActionCreated;
1035810357
}

0 commit comments

Comments
 (0)