diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 01a12f88bbf2..33038e95d00d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3853,15 +3853,15 @@ function getAdminRoomInvitedParticipants(parentReportAction: OnyxEntry { - const name = getDisplayNameForParticipant(id); + const participants = personalDetails.map((personalDetail) => { + const name = PersonalDetailsUtils.getEffectiveDisplayName(personalDetail); if (name && name?.length > 0) { return name; } diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index bc3d5baa4bff..259a470432b7 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -312,6 +312,25 @@ describe('ReportUtils', () => { expect(ReportUtils.getReportName(threadOfSubmittedReportAction, policy, submittedParentReportAction)).toBe('submitted $1.69'); }); + + test('Invited/Removed Room Member Action', () => { + const threadOfRemovedRoomMemberAction = { + ...LHNTestUtils.getFakeReport(), + type: CONST.REPORT.TYPE.CHAT, + chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM, + parentReportID: '101', + parentReportActionID: '102', + policyID: policy.id, + }; + const removedParentReportAction = { + actionName: CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.REMOVE_FROM_ROOM, + originalMessage: { + targetAccountIDs: [1], + }, + } as ReportAction; + + expect(ReportUtils.getReportName(threadOfRemovedRoomMemberAction, policy, removedParentReportAction)).toBe('removed ragnar@vikings.net'); + }); }); });