fix: client perms, @everyone/@channel, docs, unit tests
- usePermissions ORs current user roles + @everyone only (not all server roles) - cache myRolesByServer; load on active server; refresh after self role edit - gate/notify @everyone and @channel; plain @username push; special mention UI - refresh FEATURE_PARITY (DMs exist; drop stale critical gaps) - README production deploy notes dumpster.service - unit tests for permission bits and broadcast mention tokens
This commit is contained in:
@@ -6,6 +6,7 @@ import { useWebSocketStore } from '../stores/ws.ts';
|
||||
import { useServerStore } from '../stores/server.ts';
|
||||
import { useChannelStore } from '../stores/channel.ts';
|
||||
import { useLayoutStore } from '../stores/layout.ts';
|
||||
import { useRoleStore } from '../stores/role.ts';
|
||||
import { ServerBar } from './ServerBar.tsx';
|
||||
import { ChannelList } from './ChannelList.tsx';
|
||||
import { ConversationList } from './ConversationList.tsx';
|
||||
@@ -43,9 +44,18 @@ export function Layout() {
|
||||
const setMobileView = useLayoutStore((s) => s.setMobileView);
|
||||
const [showServerSettings, setShowServerSettings] = useState(false);
|
||||
const activeServerId = useServerStore((s) => s.activeServerId);
|
||||
const fetchRoles = useRoleStore((s) => s.fetchRoles);
|
||||
const fetchMyRoles = useRoleStore((s) => s.fetchMyRoles);
|
||||
const currentVoiceRoom = useVoiceStore((s) => s.currentRoom);
|
||||
const [activeTab, setActiveTab] = useState<'chat' | 'voice'>('chat');
|
||||
|
||||
// Load server roles + current user's role assignments for accurate client permission gates.
|
||||
useEffect(() => {
|
||||
if (!activeServerId || !user?.id) return;
|
||||
void fetchRoles(activeServerId);
|
||||
void fetchMyRoles(activeServerId, user.id);
|
||||
}, [activeServerId, user?.id, fetchRoles, fetchMyRoles]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentVoiceRoom) setActiveTab('voice');
|
||||
else setActiveTab('chat');
|
||||
|
||||
Reference in New Issue
Block a user