Add seperation of voice channels, creation of new ones, and move around users

This commit is contained in:
2026-03-30 02:11:39 +02:00
parent 83694570e3
commit 727059fb52
19 changed files with 614 additions and 50 deletions

View File

@@ -340,7 +340,10 @@ export const roomsReducer = createReducer(
return {
...state,
currentRoom: state.currentRoom?.id === roomId ? updatedRoom : state.currentRoom,
savedRooms: upsertRoom(state.savedRooms, updatedRoom)
savedRooms: upsertRoom(state.savedRooms, updatedRoom),
activeChannelId: state.currentRoom?.id === roomId
? resolveActiveTextChannelId(updatedRoom.channels, state.activeChannelId)
: state.activeChannelId
};
}),
@@ -411,7 +414,11 @@ export const roomsReducer = createReducer(
const existing = state.currentRoom.channels || defaultChannels();
const normalizedName = normalizeChannelName(channel.name);
if (!normalizedName || existing.some((entry) => entry.id === channel.id) || isChannelNameTaken(existing, normalizedName)) {
if (
!normalizedName
|| existing.some((entry) => entry.id === channel.id)
|| isChannelNameTaken(existing, normalizedName, channel.type)
) {
return state;
}
@@ -451,8 +458,9 @@ export const roomsReducer = createReducer(
const existing = state.currentRoom.channels || defaultChannels();
const normalizedName = normalizeChannelName(name);
const existingChannel = existing.find((channel) => channel.id === channelId);
if (!normalizedName || isChannelNameTaken(existing, normalizedName, channelId)) {
if (!normalizedName || !existingChannel || isChannelNameTaken(existing, normalizedName, existingChannel.type, channelId)) {
return state;
}