fix(channel): enforce read-only for members and polish chat info
Some checks failed
CI / test (push) Failing after 26s

- block send/forward in channels for member role on backend
- expose my_role in chat payload for client-side permissions
- hide message composer for channel members and show read-only notice
- hide members management sections for private/saved chats in info panel
- return enriched chat detail via serialize_chat_for_user
This commit is contained in:
2026-03-08 02:07:37 +03:00
parent e6a271f8be
commit afeb0acbe7
7 changed files with 109 additions and 50 deletions

View File

@@ -17,6 +17,7 @@ export function ChatsPage() {
const setActiveChatId = useChatStore((s) => s.setActiveChatId);
const loadMessages = useChatStore((s) => s.loadMessages);
const activeChat = chats.find((chat) => chat.id === activeChatId);
const isReadOnlyChannel = Boolean(activeChat && activeChat.type === "channel" && activeChat.my_role === "member");
const [infoOpen, setInfoOpen] = useState(false);
useRealtime();
@@ -61,8 +62,12 @@ export function ChatsPage() {
<div className="min-h-0 flex-1">
<MessageList />
</div>
{activeChatId ? (
{activeChatId && !isReadOnlyChannel ? (
<MessageComposer />
) : activeChatId && isReadOnlyChannel ? (
<div className="border-t border-slate-700/50 bg-slate-900/40 p-4 text-center text-sm text-slate-300/80">
Только администраторы могут публиковать сообщения в этом канале
</div>
) : (
<div className="border-t border-slate-700/50 bg-slate-900/40 p-4 text-center text-sm text-slate-300/80">
Выберите чат, чтобы начать переписку