From 387ea4ea9f3d9fac9c7aed43f7ca5cb315b2c61b Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Sat, 9 Mar 2024 22:49:25 +0530 Subject: [PATCH] fallback using last visible action message for lhn --- src/libs/ReportActionsUtils.ts | 4 ++-- src/libs/SidebarUtils.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index b12469941fd9..b2f0b90a4e09 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -482,8 +482,8 @@ function getLastVisibleAction(reportID: string, actionsToMerge: OnyxCollection = {}): LastVisibleMessage { - const lastVisibleAction = getLastVisibleAction(reportID, actionsToMerge); +function getLastVisibleMessage(reportID: string, actionsToMerge: OnyxCollection = {}, reportAction: OnyxEntry | undefined = undefined): LastVisibleMessage { + const lastVisibleAction = reportAction ?? getLastVisibleAction(reportID, actionsToMerge); const message = lastVisibleAction?.message?.[0]; if (message && isReportMessageAttachment(message)) { diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 71b3fd23a03c..40aa4c7247c6 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -357,7 +357,10 @@ function getOptionData({ } else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && lastActorDisplayName && lastMessageTextFromReport) { result.alternateText = `${lastActorDisplayName}: ${lastMessageText}`; } else { - result.alternateText = lastMessageTextFromReport.length > 0 ? lastMessageText : Localize.translate(preferredLocale, 'report.noActivityYet'); + result.alternateText = lastMessageTextFromReport.length > 0 ? lastMessageText : ReportActionsUtils.getLastVisibleMessage(report.reportID, {}, lastAction)?.lastMessageText; + if (!result.alternateText) { + result.alternateText = Localize.translate(preferredLocale, 'report.noActivityYet'); + } } } else { if (!lastMessageText) {