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

@@ -88,7 +88,8 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
return null;
}, [myRole]);
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 canEditTitle = 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);
setCounterpartBlocked(false);
}
const nextMembers = await refreshMembers(targetChatId);
const resolvedRole = String(detail.my_role ?? nextMembers.find((m) => m.user_id === me?.id)?.role ?? "").toLowerCase();
const resolvedRole = String(detail.my_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");
if (canLoadBans) {
await refreshBans(targetChatId);