Add access control rework

This commit is contained in:
2026-04-02 03:18:37 +02:00
parent 314a26325f
commit 37cac95b38
111 changed files with 5355 additions and 1892 deletions

View File

@@ -1,8 +1,6 @@
import { createReducer, on } from '@ngrx/store';
import {
Room,
RoomSettings
} from '../../shared-kernel';
import { Room, RoomSettings } from '../../shared-kernel';
import { normalizeRoomAccessControl } from '../../domains/access-control';
import { type ServerInfo } from '../../domains/server-directory';
import { RoomsActions } from './rooms.actions';
import { defaultChannels } from './room-channels.defaults';
@@ -26,12 +24,12 @@ function deduplicateRooms(rooms: Room[]): Room[] {
/** Normalize room defaults and prune any stale persisted member entries. */
function enrichRoom(room: Room): Room {
return {
return normalizeRoomAccessControl({
...room,
hasPassword: typeof room.hasPassword === 'boolean' ? room.hasPassword : !!room.password,
channels: normalizeRoomChannels(room.channels) || defaultChannels(),
members: pruneRoomMembers(room.members || [])
};
});
}
function resolveActiveTextChannelId(channels: Room['channels'], currentActiveChannelId: string): string {
@@ -422,8 +420,11 @@ export const roomsReducer = createReducer(
return state;
}
const updatedChannels = [...existing, { ...channel,
name: normalizedName }];
const updatedChannels = [
...existing,
{ ...channel,
name: normalizedName }
];
const updatedRoom = { ...state.currentRoom,
channels: updatedChannels };