From bbb203408013eaef9212fd3e6068cf8f04ad6346 Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Fri, 16 Oct 2026 21:19:47 -0400 Subject: [PATCH] fix(rooms): "Rename for me" names in search results, inbox and threads (#336) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #359: the personal room name now also shows in message-search result groups and the search room filter (whose room search matches it too), Inbox โ†’ Notifications, the threads list and the thread panel header. Verified headless with general renamed to "Zebra Lounge": a global message search and Inbox โ†’ Notifications both show "Zebra Lounge". Fixes #336 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- src/app/features/message-search/SearchFilters.tsx | 15 +++++++++++---- .../features/message-search/SearchResultGroup.tsx | 4 +++- src/app/features/room/thread/ThreadPanel.tsx | 4 +++- src/app/features/room/thread/ThreadsListPanel.tsx | 4 +++- src/app/pages/client/inbox/Notifications.tsx | 4 +++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/app/features/message-search/SearchFilters.tsx b/src/app/features/message-search/SearchFilters.tsx index 1ea4c25d2..3232f3cac 100644 --- a/src/app/features/message-search/SearchFilters.tsx +++ b/src/app/features/message-search/SearchFilters.tsx @@ -43,6 +43,7 @@ import { DebounceOptions, useDebounce } from '../../hooks/useDebounce'; import { VirtualTile } from '../../components/virtualizer'; import { stopPropagation } from '../../utils/keyboard'; import { MsgTypeFilter } from './useMessageSearch'; +import { useLocalRoomNames } from '../../hooks/useRoomMeta'; const MSG_TYPE_FILTER_OPTIONS: { msgType: MsgTypeFilter; label: string; icon: IconSrc }[] = [ { msgType: 'm.image', label: 'Images', icon: Icons.Photo }, @@ -137,14 +138,19 @@ type SelectRoomButtonProps = { onChange: (rooms?: string[]) => void; }; function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButtonProps) { + const localNames = useLocalRoomNames(); const mx = useMatrixClient(); const scrollRef = useRef(null); const [menuAnchor, setMenuAnchor] = useState(); const [localSelected, setLocalSelected] = useState(selectedRooms); const getRoomNameStr: SearchItemStrGetter = useCallback( - (rId) => mx.getRoom(rId)?.name ?? rId, - [mx], + (rId) => { + const name = mx.getRoom(rId)?.name ?? rId; + // [Gitea #336] match the personal "Rename for me" name too + return localNames[rId] ? [localNames[rId], name] : name; + }, + [mx, localNames], ); const [searchResult, _searchRoom, resetSearch] = useAsyncSearch( @@ -292,7 +298,7 @@ function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButto } > - {room.name} + {localNames[room.roomId] ?? room.name} @@ -701,6 +707,7 @@ export function SearchFilters({ pinnedOnly, onTogglePinnedOnly, }: SearchFiltersProps) { + const localNames = useLocalRoomNames(); const mx = useMatrixClient(); return ( @@ -748,7 +755,7 @@ export function SearchFilters({ } after={} > - {room.name} + {localNames[room.roomId] ?? room.name} ); })} diff --git a/src/app/features/message-search/SearchResultGroup.tsx b/src/app/features/message-search/SearchResultGroup.tsx index ae9721549..da91e7e0d 100644 --- a/src/app/features/message-search/SearchResultGroup.tsx +++ b/src/app/features/message-search/SearchResultGroup.tsx @@ -50,6 +50,7 @@ import { } from '../../hooks/useMemberPowerTag'; import { useRoomCreators } from '../../hooks/useRoomCreators'; import { useRoomCreatorsTag } from '../../hooks/useRoomCreatorsTag'; +import { useLocalRoomNames } from '../../hooks/useRoomMeta'; type SearchResultGroupProps = { room: Room; @@ -73,6 +74,7 @@ export function SearchResultGroup({ hour24Clock, dateFormatString, }: SearchResultGroupProps) { + const localNames = useLocalRoomNames(); const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); const highlightRegex = useMemo(() => makeHighlightRegex(highlights), [highlights]); @@ -212,7 +214,7 @@ export function SearchResultGroup({ /> - {room.name} + {localNames[room.roomId] ?? room.name} diff --git a/src/app/features/room/thread/ThreadPanel.tsx b/src/app/features/room/thread/ThreadPanel.tsx index a00560cf8..97e30de66 100644 --- a/src/app/features/room/thread/ThreadPanel.tsx +++ b/src/app/features/room/thread/ThreadPanel.tsx @@ -32,6 +32,7 @@ import { useThreadNotificationMode } from '../../../hooks/useThreadNotifications import { useTimestampFormatter } from '../../../hooks/useTimestampFormatter'; import { getMemberName } from '../../../utils/room'; import { ThreadNotificationMode } from '../../../utils/threadNotifications'; +import { useLocalRoomNames } from '../../../hooks/useRoomMeta'; type ThreadPanelHeaderProps = { room: Room; @@ -39,6 +40,7 @@ type ThreadPanelHeaderProps = { requestClose: () => void; }; function ThreadPanelHeader({ room, threadId, requestClose }: ThreadPanelHeaderProps) { + const localNames = useLocalRoomNames(); const mode = useThreadNotificationMode(room.roomId, threadId); const { format } = useTimestampFormatter(); // [Gitea #165] Who started the thread and when โ€” the first thing you want @@ -55,7 +57,7 @@ function ThreadPanelHeader({ room, threadId, requestClose }: ThreadPanelHeaderPr Thread - {room.name} + {localNames[room.roomId] ?? room.name} {startedBy && root && ` ยท started by ${startedBy}, ${format(root.getTs())}`} diff --git a/src/app/features/room/thread/ThreadsListPanel.tsx b/src/app/features/room/thread/ThreadsListPanel.tsx index 262ede7d4..97ddb2d39 100644 --- a/src/app/features/room/thread/ThreadsListPanel.tsx +++ b/src/app/features/room/thread/ThreadsListPanel.tsx @@ -48,6 +48,7 @@ import { useTimestampFormatter } from '../../../hooks/useTimestampFormatter'; import { formatRelativeAge } from '../../../utils/formatTimestamp'; import { useRoomNavigate } from '../../../hooks/useRoomNavigate'; import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize'; +import { useLocalRoomNames } from '../../../hooks/useRoomMeta'; // Persisted across panel opens (the panel unmounts on close). getOnInit reads // localStorage synchronously so the chosen filter/sort apply on first render. @@ -235,6 +236,7 @@ export type ThreadsListPanelProps = { onOpenThread: (threadId: string) => void; }; export function ThreadsListPanel({ room, onClose, onOpenThread }: ThreadsListPanelProps) { + const localNames = useLocalRoomNames(); const { navigateRoom } = useRoomNavigate(); const screenSize = useScreenSizeContext(); const handleJump = useCallback( @@ -361,7 +363,7 @@ export function ThreadsListPanel({ room, onClose, onOpenThread }: ThreadsListPan Threads - {room.name} + {localNames[room.roomId] ?? room.name} {totalUnread > 0 && ( diff --git a/src/app/pages/client/inbox/Notifications.tsx b/src/app/pages/client/inbox/Notifications.tsx index 02f12dcd4..7049a7042 100644 --- a/src/app/pages/client/inbox/Notifications.tsx +++ b/src/app/pages/client/inbox/Notifications.tsx @@ -98,6 +98,7 @@ import { useRoomCreatorsTag } from '../../../hooks/useRoomCreatorsTag'; import { useRoomCreators } from '../../../hooks/useRoomCreators'; import { PresenceRingAvatar } from '../../../components/presence'; import { AvatarDecoration } from '../../../components/avatar-decoration/AvatarDecoration'; +import { useLocalRoomNames } from '../../../hooks/useRoomMeta'; type RoomNotificationsGroup = { roomId: string; @@ -223,6 +224,7 @@ function RoomNotificationsGroupComp({ hour24Clock, dateFormatString, }: RoomNotificationsGroupProps) { + const localNames = useLocalRoomNames(); const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); const unread = useRoomUnread(room.roomId, roomToUnreadAtom); @@ -428,7 +430,7 @@ function RoomNotificationsGroupComp({ /> - {room.name} + {localNames[room.roomId] ?? room.name}