fix: persist server mute/deafen state across reloads and prevent client bypass
Server-side: add DB persistence for voice restrictions (schema, migration, ready payload, cleanup on leave). Client-side: fix four bugs that wiped or bypassed server restriction state — leaveVoice() no longer clears global restriction Sets, voice_state_update leave no longer drops amber icons, toggleMic/toggleDeafen now guard against server restrictions, and force-mute/ deafen uses direct setState instead of fragile toggle calls.
This commit is contained in:
@@ -217,3 +217,13 @@ export const joinRequests = sqliteTable('join_requests', {
|
||||
createdAt: integer('created_at').notNull(),
|
||||
decidedAt: integer('decided_at'),
|
||||
});
|
||||
|
||||
export const voiceRestrictions = sqliteTable('voice_restrictions', {
|
||||
spaceId: text('space_id').notNull().references(() => spaces.id, { onDelete: 'cascade' }),
|
||||
userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
|
||||
restrictionType: text('restriction_type').notNull(), // 'mute' | 'deafen'
|
||||
moderatorId: text('moderator_id').notNull().references(() => users.id),
|
||||
createdAt: integer('created_at').notNull(),
|
||||
}, (table) => ({
|
||||
pk: primaryKey({ columns: [table.spaceId, table.userId, table.restrictionType] }),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user