@@ -36,6 +36,7 @@ import {
3636 isIOUActionMatchingTransactionList ,
3737 isNewerReportAction ,
3838 isReportActionVisibleAsLastAction ,
39+ isResolvedActionableWhisper ,
3940} from '../../src/libs/ReportActionsUtils' ;
4041import { buildOptimisticCreatedReportForUnapprovedAction } from '../../src/libs/ReportUtils' ;
4142import ONYXKEYS from '../../src/ONYXKEYS' ;
@@ -1028,6 +1029,65 @@ describe('ReportActionsUtils', () => {
10281029 // Then the whisper with deleted set should be filtered out, leaving only the ADD_COMMENT
10291030 expect ( result ) . toStrictEqual ( [ input . at ( 0 ) ] ) ;
10301031 } ) ;
1032+
1033+ it ( 'should keep ACTIONABLE_MENTION_WHISPER visible when deleted is set but parent comment is not deleted' , ( ) => {
1034+ // Given a parent ADD_COMMENT (ID N) and an ACTIONABLE_MENTION_WHISPER (ID N+1) whose
1035+ // originalMessage.deleted is set (e.g. from the backend one-per-user cleanup rule).
1036+ // Use sequential IDs so the parent check can find the parent via whisperID - 1.
1037+ const parentID = '1000000000000000' ;
1038+ const whisperID = '1000000000000001' ;
1039+
1040+ const parentAction : ReportAction = {
1041+ created : '2024-11-19 08:04:13.728' ,
1042+ reportActionID : parentID ,
1043+ reportID : '1' ,
1044+ actionName : CONST . REPORT . ACTIONS . TYPE . ADD_COMMENT ,
1045+ originalMessage : {
1046+ html : '<mention-user accountID="18414674"/>' ,
1047+ whisperedTo : [ ] ,
1048+ lastModified : '2024-11-19 08:04:13.728' ,
1049+ } ,
1050+ message : [
1051+ {
1052+ html : '<mention-user accountID="18414674"/>' ,
1053+ text : '@someone' ,
1054+ type : 'COMMENT' ,
1055+ whisperedTo : [ ] ,
1056+ } ,
1057+ ] ,
1058+ } ;
1059+
1060+ const whisperAction : ReportAction = {
1061+ created : '2024-11-19 08:04:13.730' ,
1062+ reportActionID : whisperID ,
1063+ reportID : '1' ,
1064+ actionName : CONST . REPORT . ACTIONS . TYPE . ACTIONABLE_MENTION_WHISPER ,
1065+ originalMessage : {
1066+ inviteeAccountIDs : [ 18414674 ] ,
1067+ lastModified : '2024-11-19 08:04:25.813' ,
1068+ whisperedTo : [ 18301266 ] ,
1069+ deleted : '2024-11-19 08:04:27.000' ,
1070+ } ,
1071+ message : [
1072+ {
1073+ html : "Heads up, <mention-user accountID=18414674></mention-user> isn't a member of this room." ,
1074+ text : "Heads up, isn't a member of this room." ,
1075+ type : 'COMMENT' ,
1076+ } ,
1077+ ] ,
1078+ } ;
1079+
1080+ const allActionsForReport : ReportActions = {
1081+ [ parentID ] : parentAction ,
1082+ [ whisperID ] : whisperAction ,
1083+ } ;
1084+
1085+ // When checking whether the whisper is resolved, providing the full action set
1086+ const result = isResolvedActionableWhisper ( whisperAction , allActionsForReport ) ;
1087+
1088+ // Then the whisper should NOT be treated as resolved because its parent is still present and not deleted
1089+ expect ( result ) . toBe ( false ) ;
1090+ } ) ;
10311091 } ) ;
10321092
10331093 describe ( 'hasRequestFromCurrentAccount' , ( ) => {
0 commit comments