@@ -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 = false ) : 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 ;
@@ -858,7 +852,7 @@ function getLastMessageTextForReport(
858852 // we do not want to show report closed in LHN for non archived report so use getReportLastMessage as fallback instead of lastMessageText from report
859853 if (
860854 reportID &&
861- ! isArchivedReport ( reportNameValuePairs ) &&
855+ ! isReportArchived &&
862856 ( report . lastActionType === CONST . REPORT . ACTIONS . TYPE . CLOSED || ( lastOriginalReportAction ?. reportActionID && isDeletedAction ( lastOriginalReportAction ) ) )
863857 ) {
864858 return lastMessageTextFromReport || ( getReportLastMessage ( reportID ) . lastMessageText ?? '' ) ;
@@ -973,7 +967,7 @@ function createOption(accountIDs: number[], personalDetails: OnyxInputOrEntry<Pe
973967 const lastActorAccountID = report . lastActorAccountID || lastAction ?. actorAccountID ;
974968 const lastActorDetails = lastActorAccountID ? ( personalDetails ?. [ lastActorAccountID ] ?? null ) : null ;
975969 const lastActorDisplayName = getLastActorDisplayName ( lastActorDetails ) ;
976- const lastMessageTextFromReport = getLastMessageTextForReport ( report , lastActorDetails , undefined , reportNameValuePairs ) ;
970+ const lastMessageTextFromReport = getLastMessageTextForReport ( report , lastActorDetails , undefined , ! ! result . private_isArchived ) ;
977971 let lastMessageText = lastMessageTextFromReport ;
978972
979973 const shouldDisplayLastActorName =
0 commit comments