diff --git a/docs/core-checklist-status.md b/docs/core-checklist-status.md index 5559757..8923d54 100644 --- a/docs/core-checklist-status.md +++ b/docs/core-checklist-status.md @@ -29,7 +29,7 @@ Legend: 20. GIF - `PARTIAL` (web GIF picker with Tenor search + preset fallback + favorites) 21. Message History/Search - `DONE` (history/pagination/chat+global search) 22. Text Formatting - `PARTIAL` (bold/italic/underline/spoiler/mono/links + strikethrough + quote/code block; toolbar still evolving) -23. Groups - `PARTIAL` (create/add/remove/invite link; join-by-invite and invite permissions covered by integration tests; members API now returns profile fields (`username/name/avatar_url`) for richer moderation UI; advanced moderation still partial) +23. Groups - `PARTIAL` (create/add/remove/invite link; join-by-invite and invite permissions covered by integration tests; members API now returns profile fields (`username/name/avatar_url`) and web Chat Info consumes them to avoid extra per-member profile requests; advanced moderation still partial) 24. Roles - `DONE` (owner/admin/member) 25. Admin Rights - `PARTIAL` (delete/pin/edit info + explicit ban APIs for groups/channels including ban list endpoint; web Chat Info now shows searchable `Banned users` with right-click `Unban` action for owner/admin, plus member search and invite-link copy/regenerate actions; integration tests cover channel member read-only, channel admin full-delete, channel message delete-for-all permissions, group profile edit permissions, owner-only role management rules, and admin-visible/member-forbidden ban-list access; remaining UX moderation tools limited) 26. Channels - `PARTIAL` (create/post/edit/delete/subscribe/unsubscribe; integration tests now also cover invite-link permissions (member forbidden, admin allowed); UX edge-cases still polishing) diff --git a/web/src/chat/types.ts b/web/src/chat/types.ts index 1b92275..eaae039 100644 --- a/web/src/chat/types.ts +++ b/web/src/chat/types.ts @@ -46,6 +46,9 @@ export interface ChatMember { user_id: number; role: ChatMemberRole; joined_at: string; + username?: string | null; + name?: string | null; + avatar_url?: string | null; } export interface ChatBan { diff --git a/web/src/components/ChatInfoPanel.tsx b/web/src/components/ChatInfoPanel.tsx index fd8e57d..4c47d6e 100644 --- a/web/src/components/ChatInfoPanel.tsx +++ b/web/src/components/ChatInfoPanel.tsx @@ -134,11 +134,31 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) { async function refreshMembers(targetChatId: number): Promise { const nextMembers = await listChatMembers(targetChatId); setMembers(nextMembers); - const ids = [...new Set(nextMembers.map((m) => m.user_id))]; - const profiles = await Promise.all(ids.map((id) => getUserById(id))); const byId: Record = {}; - for (const profile of profiles) { - byId[profile.id] = profile; + const missingIds: number[] = []; + for (const member of nextMembers) { + if (member.name || member.username || member.avatar_url) { + byId[member.user_id] = { + id: member.user_id, + email: "", + name: member.name || member.username || `user #${member.user_id}`, + username: member.username || `user${member.user_id}`, + bio: null, + avatar_url: member.avatar_url || null, + email_verified: false, + allow_private_messages: true, + created_at: "", + updated_at: "", + }; + } else { + missingIds.push(member.user_id); + } + } + if (missingIds.length) { + const profiles = await Promise.all(missingIds.map((id) => getUserById(id))); + for (const profile of profiles) { + byId[profile.id] = profile; + } } setMemberUsers(byId); return nextMembers;