web: hide participants list in group and channel info for members
Some checks failed
CI / test (push) Failing after 2m10s

This commit is contained in:
2026-03-08 22:53:30 +03:00
parent f3f593c8c9
commit 0bc7760eee
2 changed files with 11 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ Legend:
22. Text Formatting - `DONE` (bold/italic/underline/spoiler/mono/links + strikethrough + quote/code block; web composer supports keyboard shortcuts `Ctrl/Cmd+B/I/U/K`, `Ctrl/Cmd+Shift+X`, `Ctrl/Cmd+Shift+\``) 22. Text Formatting - `DONE` (bold/italic/underline/spoiler/mono/links + strikethrough + quote/code block; web composer supports keyboard shortcuts `Ctrl/Cmd+B/I/U/K`, `Ctrl/Cmd+Shift+X`, `Ctrl/Cmd+Shift+\``)
23. Groups - `DONE` (create/add/remove/invite link with role-aware moderation flows in web Chat Info and covered invite/join behavior) 23. Groups - `DONE` (create/add/remove/invite link with role-aware moderation flows in web Chat Info and covered invite/join behavior)
24. Roles - `DONE` (owner/admin/member) 24. Roles - `DONE` (owner/admin/member)
25. Admin Rights - `DONE` (delete/pin/edit info + ban/unban/member role management with role-gated UI and APIs for groups/channels) 25. Admin Rights - `DONE` (delete/pin/edit info + ban/unban/member role management with role-gated UI and APIs for groups/channels; member role no longer sees participants lists in group/channel chat info)
26. Channels - `DONE` (create/post/edit/delete/subscribe/unsubscribe with role-aware channel behavior and invite-link flows) 26. Channels - `DONE` (create/post/edit/delete/subscribe/unsubscribe with role-aware channel behavior and invite-link flows)
27. Channel Types - `DONE` (public/private) 27. Channel Types - `DONE` (public/private)
28. Notifications - `DONE` (browser notifications + mute/settings/sound; mention override for muted chats, realtime sync for mute state, notification click deep-link (`/?chat=..&message=..`) restores chat/message focus after auth) 28. Notifications - `DONE` (browser notifications + mute/settings/sound; mention override for muted chats, realtime sync for mute state, notification click deep-link (`/?chat=..&message=..`) restores chat/message focus after auth)

View File

@@ -88,7 +88,8 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
return null; return null;
}, [myRole]); }, [myRole]);
const isGroupLike = chat?.type === "group" || chat?.type === "channel"; const isGroupLike = chat?.type === "group" || chat?.type === "channel";
const showMembersSection = Boolean(chat && isGroupLike && !chat.is_saved); const canViewMembersList = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin"));
const showMembersSection = Boolean(chat && isGroupLike && !chat.is_saved && canViewMembersList);
const canManageMembers = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin")); const canManageMembers = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin"));
const canEditTitle = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin")); const canEditTitle = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin"));
const canEditChatProfile = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin")); const canEditChatProfile = Boolean(isGroupLike && (myRoleNormalized === "owner" || myRoleNormalized === "admin"));
@@ -225,8 +226,14 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
setCounterpartProfile(null); setCounterpartProfile(null);
setCounterpartBlocked(false); setCounterpartBlocked(false);
} }
const nextMembers = await refreshMembers(targetChatId); const resolvedRole = String(detail.my_role ?? "").toLowerCase();
const resolvedRole = String(detail.my_role ?? nextMembers.find((m) => m.user_id === me?.id)?.role ?? "").toLowerCase(); const canLoadMembers = (detail.type === "group" || detail.type === "channel") && (resolvedRole === "owner" || resolvedRole === "admin");
if (canLoadMembers) {
await refreshMembers(targetChatId);
} else {
setMembers([]);
setMemberUsers({});
}
const canLoadBans = (detail.type === "group" || detail.type === "channel") && (resolvedRole === "owner" || resolvedRole === "admin"); const canLoadBans = (detail.type === "group" || detail.type === "channel") && (resolvedRole === "owner" || resolvedRole === "admin");
if (canLoadBans) { if (canLoadBans) {
await refreshBans(targetChatId); await refreshBans(targetChatId);