Add seperation of voice channels, creation of new ones, and move around users
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user