Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,10 @@ function uniqFast(items: string[]): string[] {
* Get the last actor display name from last actor details.
*/
function getLastActorDisplayName(lastActorDetails: Partial<PersonalDetails> | 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');
: '';
}

/**
Expand Down
6 changes: 0 additions & 6 deletions tests/unit/OptionsListUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
filterSelfDMChat,
filterWorkspaceChats,
formatMemberForList,
getLastActorDisplayName,
getMemberInviteOptions,
getSearchOptions,
getShareDestinationOptions,
Expand Down Expand Up @@ -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));

Expand Down