@@ -125,7 +125,6 @@ import {
125125 getUpgradeWorkspaceMessage ,
126126 hasIOUWaitingOnCurrentUserBankAccount ,
127127 isArchivedNonExpenseReport ,
128- isArchivedReport ,
129128 isChatThread ,
130129 isDefaultRoom ,
131130 isDM ,
@@ -717,20 +716,15 @@ function hasHiddenDisplayNames(accountIDs: number[]) {
717716/**
718717 * Get the last message text from the report directly or from other sources for special cases.
719718 */
720- function getLastMessageTextForReport (
721- report : OnyxEntry < Report > ,
722- lastActorDetails : Partial < PersonalDetails > | null ,
723- policy ?: OnyxEntry < Policy > ,
724- reportNameValuePairs ?: OnyxInputOrEntry < ReportNameValuePairs > ,
725- ) : string {
719+ function getLastMessageTextForReport ( report : OnyxEntry < Report > , lastActorDetails : Partial < PersonalDetails > | null , policy ?: OnyxEntry < Policy > , isReportArchived ?: boolean ) : string {
726720 const reportID = report ?. reportID ;
727721 const lastReportAction = reportID ? lastVisibleReportActions [ reportID ] : undefined ;
728722
729723 // some types of actions are filtered out for lastReportAction, in some cases we need to check the actual last action
730724 const lastOriginalReportAction = reportID ? lastReportActions [ reportID ] : undefined ;
731725 let lastMessageTextFromReport = '' ;
732726
733- if ( isArchivedNonExpenseReport ( report , ! ! reportNameValuePairs ?. private_isArchived ) ) {
727+ if ( isArchivedNonExpenseReport ( report , isReportArchived ) ) {
734728 const archiveReason =
735729 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
736730 ( isClosedAction ( lastOriginalReportAction ) && getOriginalMessage ( lastOriginalReportAction ) ?. reason ) || CONST . REPORT . ARCHIVE_REASON . DEFAULT ;
@@ -856,7 +850,7 @@ function getLastMessageTextForReport(
856850 // we do not want to show report closed in LHN for non archived report so use getReportLastMessage as fallback instead of lastMessageText from report
857851 if (
858852 reportID &&
859- ! isArchivedReport ( reportNameValuePairs ) &&
853+ ! isReportArchived &&
860854 ( report . lastActionType === CONST . REPORT . ACTIONS . TYPE . CLOSED || ( lastOriginalReportAction ?. reportActionID && isDeletedAction ( lastOriginalReportAction ) ) )
861855 ) {
862856 return lastMessageTextFromReport || ( getReportLastMessage ( reportID ) . lastMessageText ?? '' ) ;
@@ -971,7 +965,7 @@ function createOption(accountIDs: number[], personalDetails: OnyxInputOrEntry<Pe
971965 const lastActorAccountID = report . lastActorAccountID || lastAction ?. actorAccountID ;
972966 const lastActorDetails = lastActorAccountID ? ( personalDetails ?. [ lastActorAccountID ] ?? null ) : null ;
973967 const lastActorDisplayName = getLastActorDisplayName ( lastActorDetails ) ;
974- const lastMessageTextFromReport = getLastMessageTextForReport ( report , lastActorDetails , undefined , reportNameValuePairs ) ;
968+ const lastMessageTextFromReport = getLastMessageTextForReport ( report , lastActorDetails , undefined , ! ! reportNameValuePairs ?. private_isArchived ) ;
975969 let lastMessageText = lastMessageTextFromReport ;
976970
977971 const shouldDisplayLastActorName =
0 commit comments