fix(rooms): "Rename for me" names in search results, inbox and threads (#336)
CI / Build & Quality Checks (pull_request) Successful in 1m50s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 6s
CI / Playwright smoke (e2e) (pull_request) Successful in 15m5s
CI / Build & Quality Checks (pull_request) Successful in 1m50s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 6s
CI / Playwright smoke (e2e) (pull_request) Successful in 15m5s
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
400ee76b63
commit
bbb2034080
@@ -43,6 +43,7 @@ import { DebounceOptions, useDebounce } from '../../hooks/useDebounce';
|
|||||||
import { VirtualTile } from '../../components/virtualizer';
|
import { VirtualTile } from '../../components/virtualizer';
|
||||||
import { stopPropagation } from '../../utils/keyboard';
|
import { stopPropagation } from '../../utils/keyboard';
|
||||||
import { MsgTypeFilter } from './useMessageSearch';
|
import { MsgTypeFilter } from './useMessageSearch';
|
||||||
|
import { useLocalRoomNames } from '../../hooks/useRoomMeta';
|
||||||
|
|
||||||
const MSG_TYPE_FILTER_OPTIONS: { msgType: MsgTypeFilter; label: string; icon: IconSrc }[] = [
|
const MSG_TYPE_FILTER_OPTIONS: { msgType: MsgTypeFilter; label: string; icon: IconSrc }[] = [
|
||||||
{ msgType: 'm.image', label: 'Images', icon: Icons.Photo },
|
{ msgType: 'm.image', label: 'Images', icon: Icons.Photo },
|
||||||
@@ -137,14 +138,19 @@ type SelectRoomButtonProps = {
|
|||||||
onChange: (rooms?: string[]) => void;
|
onChange: (rooms?: string[]) => void;
|
||||||
};
|
};
|
||||||
function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButtonProps) {
|
function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButtonProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
const [menuAnchor, setMenuAnchor] = useState<RectCords>();
|
const [menuAnchor, setMenuAnchor] = useState<RectCords>();
|
||||||
const [localSelected, setLocalSelected] = useState(selectedRooms);
|
const [localSelected, setLocalSelected] = useState(selectedRooms);
|
||||||
|
|
||||||
const getRoomNameStr: SearchItemStrGetter<string> = useCallback(
|
const getRoomNameStr: SearchItemStrGetter<string> = useCallback(
|
||||||
(rId) => mx.getRoom(rId)?.name ?? rId,
|
(rId) => {
|
||||||
[mx],
|
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(
|
const [searchResult, _searchRoom, resetSearch] = useAsyncSearch(
|
||||||
@@ -292,7 +298,7 @@ function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButto
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Text truncate size="T300">
|
<Text truncate size="T300">
|
||||||
{room.name}
|
{localNames[room.roomId] ?? room.name}
|
||||||
</Text>
|
</Text>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</VirtualTile>
|
</VirtualTile>
|
||||||
@@ -701,6 +707,7 @@ export function SearchFilters({
|
|||||||
pinnedOnly,
|
pinnedOnly,
|
||||||
onTogglePinnedOnly,
|
onTogglePinnedOnly,
|
||||||
}: SearchFiltersProps) {
|
}: SearchFiltersProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -748,7 +755,7 @@ export function SearchFilters({
|
|||||||
}
|
}
|
||||||
after={<Icon size="50" src={Icons.Cross} />}
|
after={<Icon size="50" src={Icons.Cross} />}
|
||||||
>
|
>
|
||||||
<Text size="T200">{room.name}</Text>
|
<Text size="T200">{localNames[room.roomId] ?? room.name}</Text>
|
||||||
</Chip>
|
</Chip>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import {
|
|||||||
} from '../../hooks/useMemberPowerTag';
|
} from '../../hooks/useMemberPowerTag';
|
||||||
import { useRoomCreators } from '../../hooks/useRoomCreators';
|
import { useRoomCreators } from '../../hooks/useRoomCreators';
|
||||||
import { useRoomCreatorsTag } from '../../hooks/useRoomCreatorsTag';
|
import { useRoomCreatorsTag } from '../../hooks/useRoomCreatorsTag';
|
||||||
|
import { useLocalRoomNames } from '../../hooks/useRoomMeta';
|
||||||
|
|
||||||
type SearchResultGroupProps = {
|
type SearchResultGroupProps = {
|
||||||
room: Room;
|
room: Room;
|
||||||
@@ -73,6 +74,7 @@ export function SearchResultGroup({
|
|||||||
hour24Clock,
|
hour24Clock,
|
||||||
dateFormatString,
|
dateFormatString,
|
||||||
}: SearchResultGroupProps) {
|
}: SearchResultGroupProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const useAuthentication = useMediaAuthentication();
|
const useAuthentication = useMediaAuthentication();
|
||||||
const highlightRegex = useMemo(() => makeHighlightRegex(highlights), [highlights]);
|
const highlightRegex = useMemo(() => makeHighlightRegex(highlights), [highlights]);
|
||||||
@@ -212,7 +214,7 @@ export function SearchResultGroup({
|
|||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Text size="H4" truncate>
|
<Text size="H4" truncate>
|
||||||
{room.name}
|
{localNames[room.roomId] ?? room.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Header>
|
</Header>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { useThreadNotificationMode } from '../../../hooks/useThreadNotifications
|
|||||||
import { useTimestampFormatter } from '../../../hooks/useTimestampFormatter';
|
import { useTimestampFormatter } from '../../../hooks/useTimestampFormatter';
|
||||||
import { getMemberName } from '../../../utils/room';
|
import { getMemberName } from '../../../utils/room';
|
||||||
import { ThreadNotificationMode } from '../../../utils/threadNotifications';
|
import { ThreadNotificationMode } from '../../../utils/threadNotifications';
|
||||||
|
import { useLocalRoomNames } from '../../../hooks/useRoomMeta';
|
||||||
|
|
||||||
type ThreadPanelHeaderProps = {
|
type ThreadPanelHeaderProps = {
|
||||||
room: Room;
|
room: Room;
|
||||||
@@ -39,6 +40,7 @@ type ThreadPanelHeaderProps = {
|
|||||||
requestClose: () => void;
|
requestClose: () => void;
|
||||||
};
|
};
|
||||||
function ThreadPanelHeader({ room, threadId, requestClose }: ThreadPanelHeaderProps) {
|
function ThreadPanelHeader({ room, threadId, requestClose }: ThreadPanelHeaderProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const mode = useThreadNotificationMode(room.roomId, threadId);
|
const mode = useThreadNotificationMode(room.roomId, threadId);
|
||||||
const { format } = useTimestampFormatter();
|
const { format } = useTimestampFormatter();
|
||||||
// [Gitea #165] Who started the thread and when — the first thing you want
|
// [Gitea #165] Who started the thread and when — the first thing you want
|
||||||
@@ -55,7 +57,7 @@ function ThreadPanelHeader({ room, threadId, requestClose }: ThreadPanelHeaderPr
|
|||||||
Thread
|
Thread
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="T200" truncate style={{ opacity: 0.65 }}>
|
<Text size="T200" truncate style={{ opacity: 0.65 }}>
|
||||||
{room.name}
|
{localNames[room.roomId] ?? room.name}
|
||||||
{startedBy && root && ` · started by ${startedBy}, ${format(root.getTs())}`}
|
{startedBy && root && ` · started by ${startedBy}, ${format(root.getTs())}`}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import { useTimestampFormatter } from '../../../hooks/useTimestampFormatter';
|
|||||||
import { formatRelativeAge } from '../../../utils/formatTimestamp';
|
import { formatRelativeAge } from '../../../utils/formatTimestamp';
|
||||||
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
|
||||||
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
||||||
|
import { useLocalRoomNames } from '../../../hooks/useRoomMeta';
|
||||||
|
|
||||||
// Persisted across panel opens (the panel unmounts on close). getOnInit reads
|
// Persisted across panel opens (the panel unmounts on close). getOnInit reads
|
||||||
// localStorage synchronously so the chosen filter/sort apply on first render.
|
// localStorage synchronously so the chosen filter/sort apply on first render.
|
||||||
@@ -235,6 +236,7 @@ export type ThreadsListPanelProps = {
|
|||||||
onOpenThread: (threadId: string) => void;
|
onOpenThread: (threadId: string) => void;
|
||||||
};
|
};
|
||||||
export function ThreadsListPanel({ room, onClose, onOpenThread }: ThreadsListPanelProps) {
|
export function ThreadsListPanel({ room, onClose, onOpenThread }: ThreadsListPanelProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const { navigateRoom } = useRoomNavigate();
|
const { navigateRoom } = useRoomNavigate();
|
||||||
const screenSize = useScreenSizeContext();
|
const screenSize = useScreenSizeContext();
|
||||||
const handleJump = useCallback(
|
const handleJump = useCallback(
|
||||||
@@ -361,7 +363,7 @@ export function ThreadsListPanel({ room, onClose, onOpenThread }: ThreadsListPan
|
|||||||
Threads
|
Threads
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="T200" truncate style={{ opacity: 0.65 }}>
|
<Text size="T200" truncate style={{ opacity: 0.65 }}>
|
||||||
{room.name}
|
{localNames[room.roomId] ?? room.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
{totalUnread > 0 && (
|
{totalUnread > 0 && (
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ import { useRoomCreatorsTag } from '../../../hooks/useRoomCreatorsTag';
|
|||||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||||
import { PresenceRingAvatar } from '../../../components/presence';
|
import { PresenceRingAvatar } from '../../../components/presence';
|
||||||
import { AvatarDecoration } from '../../../components/avatar-decoration/AvatarDecoration';
|
import { AvatarDecoration } from '../../../components/avatar-decoration/AvatarDecoration';
|
||||||
|
import { useLocalRoomNames } from '../../../hooks/useRoomMeta';
|
||||||
|
|
||||||
type RoomNotificationsGroup = {
|
type RoomNotificationsGroup = {
|
||||||
roomId: string;
|
roomId: string;
|
||||||
@@ -223,6 +224,7 @@ function RoomNotificationsGroupComp({
|
|||||||
hour24Clock,
|
hour24Clock,
|
||||||
dateFormatString,
|
dateFormatString,
|
||||||
}: RoomNotificationsGroupProps) {
|
}: RoomNotificationsGroupProps) {
|
||||||
|
const localNames = useLocalRoomNames();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const useAuthentication = useMediaAuthentication();
|
const useAuthentication = useMediaAuthentication();
|
||||||
const unread = useRoomUnread(room.roomId, roomToUnreadAtom);
|
const unread = useRoomUnread(room.roomId, roomToUnreadAtom);
|
||||||
@@ -428,7 +430,7 @@ function RoomNotificationsGroupComp({
|
|||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Text size="H4" truncate>
|
<Text size="H4" truncate>
|
||||||
{room.name}
|
{localNames[room.roomId] ?? room.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box shrink="No">
|
<Box shrink="No">
|
||||||
|
|||||||
Reference in New Issue
Block a user