DP18: add getMemberName helper and dedup name-fallback sites
Add a pure `getMemberName(room, userId): string` helper in utils/room.ts (= getMemberDisplayName ?? getMxIdLocalPart ?? userId) and replace the inline `getMemberDisplayName(room, id) ?? getMxIdLocalPart(id) ?? id` fallback across the codebase. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
UnreadInfo,
|
||||
} from '../../types/matrix/room';
|
||||
import { getMutedThreads, ThreadNotificationsContent } from './threadNotifications';
|
||||
import { getMxIdLocalPart } from './matrix';
|
||||
|
||||
export const getStateEvent = (
|
||||
room: Room,
|
||||
@@ -405,6 +406,9 @@ export const getMemberDisplayName = (room: Room, userId: string): string | undef
|
||||
return name;
|
||||
};
|
||||
|
||||
export const getMemberName = (room: Room, userId: string): string =>
|
||||
getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
|
||||
|
||||
export const getMemberSearchStr = (
|
||||
member: RoomMember,
|
||||
query: string,
|
||||
|
||||
Reference in New Issue
Block a user