Add access control rework
This commit is contained in:
@@ -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 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user