diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index b42bbc133568..4910254d5cfc 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -534,14 +534,10 @@ function uniqFast(items: string[]): string[] { * Get the last actor display name from last actor details. */ function getLastActorDisplayName(lastActorDetails: Partial | null, hasMultipleParticipants: boolean) { - if (!hasMultipleParticipants || !lastActorDetails) { - return ''; - } - - return lastActorDetails.accountID !== currentUserAccountID + return hasMultipleParticipants && lastActorDetails && lastActorDetails.accountID !== currentUserAccountID ? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing lastActorDetails.firstName || formatPhoneNumber(getDisplayNameOrDefault(lastActorDetails)) - : translateLocal('common.you'); + : ''; } /** diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index 417eba293869..5a964cd7d6f0 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -13,7 +13,6 @@ import { filterSelfDMChat, filterWorkspaceChats, formatMemberForList, - getLastActorDisplayName, getMemberInviteOptions, getSearchOptions, getShareDestinationOptions, @@ -812,11 +811,6 @@ describe('OptionsListUtils', () => { expect(results.personalDetails.at(3)?.text).toBe('Invisible Woman'); }); - it('getLastActorDisplayName()', () => { - expect(getLastActorDisplayName(PERSONAL_DETAILS['2'], true)).toBe('You'); - expect(getLastActorDisplayName(PERSONAL_DETAILS['3'], true)).toBe('Spider-Man'); - }); - it('formatMemberForList()', () => { const formattedMembers = Object.values(PERSONAL_DETAILS).map((personalDetail) => formatMemberForList(personalDetail));