web: hide participants list in group and channel info for members
Some checks failed
CI / test (push) Failing after 2m10s
Some checks failed
CI / test (push) Failing after 2m10s
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user