@@ -1078,14 +1078,36 @@ const supportedActionTypes = new Set<ReportActionName>([...Object.values(otherAc
10781078 * Checks whether an action is actionable track expense and resolved.
10791079 *
10801080 */
1081- function isResolvedActionableWhisper ( reportAction : OnyxEntry < ReportAction > ) : boolean {
1081+ function isResolvedActionableWhisper ( reportAction : OnyxEntry < ReportAction > , allActionsForReport ?: OnyxEntry < ReportActions > ) : boolean {
10821082 const originalMessage = getOriginalMessage ( reportAction ) ;
10831083 if ( ! originalMessage || typeof originalMessage !== 'object' ) {
10841084 return false ;
10851085 }
10861086 const resolution = 'resolution' in originalMessage ? originalMessage ?. resolution : null ;
1087+ if ( resolution ) {
1088+ return true ;
1089+ }
1090+
10871091 const deleted = 'deleted' in originalMessage ? originalMessage ?. deleted : null ;
1088- return ! ! resolution || ! ! deleted ;
1092+ if ( ! deleted ) {
1093+ return false ;
1094+ }
1095+
1096+ // For mention whispers, only treat as deleted if the parent comment is also deleted.
1097+ // This distinguishes cascade deletion (parent deleted -> whisper should hide) from
1098+ // the backend's one-per-user cleanup (parent still exists -> whisper should stay visible).
1099+ if ( allActionsForReport && reportAction ?. reportActionID ) {
1100+ if ( isActionableMentionWhisper ( reportAction ) || isActionableReportMentionWhisper ( reportAction ) ) {
1101+ const parentOffset = isActionableReportMentionWhisper ( reportAction ) ? 2n : 1n ;
1102+ const parentActionID = String ( BigInt ( reportAction . reportActionID ) - parentOffset ) ;
1103+ const parentAction = allActionsForReport [ parentActionID ] ;
1104+ if ( parentAction && ! isDeletedAction ( parentAction ) ) {
1105+ return false ;
1106+ }
1107+ }
1108+ }
1109+
1110+ return true ;
10891111}
10901112
10911113/**
@@ -1110,7 +1132,13 @@ function isResolvedConciergeDescriptionOptions(reportAction: OnyxEntry<ReportAct
11101132 * Checks if a reportAction is fit for display, meaning that it's not deprecated, is of a valid
11111133 * and supported type, it's not deleted and also not closed.
11121134 */
1113- function shouldReportActionBeVisible ( reportAction : OnyxEntry < ReportAction > , key : string | number , canUserPerformWriteAction ?: boolean , reportsParam ?: OnyxCollection < Report > ) : boolean {
1135+ function shouldReportActionBeVisible (
1136+ reportAction : OnyxEntry < ReportAction > ,
1137+ key : string | number ,
1138+ canUserPerformWriteAction ?: boolean ,
1139+ reportsParam ?: OnyxCollection < Report > ,
1140+ allActionsForReport ?: OnyxEntry < ReportActions > ,
1141+ ) : boolean {
11141142 if ( ! reportAction ) {
11151143 return false ;
11161144 }
@@ -1187,7 +1215,7 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key:
11871215 }
11881216
11891217 // If action is actionable whisper and resolved by user, then we don't want to render anything
1190- if ( isActionableWhisper ( reportAction ) && isResolvedActionableWhisper ( reportAction ) ) {
1218+ if ( isActionableWhisper ( reportAction ) && isResolvedActionableWhisper ( reportAction , allActionsForReport ) ) {
11911219 return false ;
11921220 }
11931221
0 commit comments