Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -54,7 +54,7 @@ export function CreateRoomForm({ defaultKind, space, onCreate }: CreateRoomFormP
|
||||
const allowRestricted = space && restrictedSupported(selectedRoomVersion);
|
||||
|
||||
const [kind, setKind] = useState(
|
||||
defaultKind ?? allowRestricted ? CreateRoomKind.Restricted : CreateRoomKind.Private
|
||||
(defaultKind ?? allowRestricted) ? CreateRoomKind.Restricted : CreateRoomKind.Private,
|
||||
);
|
||||
const allowAdditionalCreators = creatorsSupported(selectedRoomVersion);
|
||||
const { additionalCreators, addAdditionalCreator, removeAdditionalCreator } =
|
||||
@@ -77,7 +77,7 @@ export function CreateRoomForm({ defaultKind, space, onCreate }: CreateRoomFormP
|
||||
};
|
||||
|
||||
const [createState, create] = useAsyncCallback<string, Error | MatrixError, [CreateRoomData]>(
|
||||
useCallback((data) => createRoom(mx, data), [mx])
|
||||
useCallback((data) => createRoom(mx, data), [mx]),
|
||||
);
|
||||
const loading = createState.status === AsyncStatus.Loading;
|
||||
const error = createState.status === AsyncStatus.Error ? createState.error : undefined;
|
||||
@@ -292,7 +292,7 @@ export function CreateRoomForm({ defaultKind, space, onCreate }: CreateRoomFormP
|
||||
<b>
|
||||
{error instanceof MatrixError && error.name === ErrorCode.M_LIMIT_EXCEEDED
|
||||
? `Server rate-limited your request for ${millisecondsToMinutes(
|
||||
(error.data.retry_after_ms as number | undefined) ?? 0
|
||||
(error.data.retry_after_ms as number | undefined) ?? 0,
|
||||
)} minutes!`
|
||||
: error.message}
|
||||
</b>
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Box, config, Header, IconButton, Modal, Overlay, OverlayBackdrop, OverlayCenter, Scroll, Text } from 'folds';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import {
|
||||
Box,
|
||||
config,
|
||||
Header,
|
||||
IconButton,
|
||||
Modal,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
Scroll,
|
||||
Text,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import { useAllJoinedRoomsSet, useGetRoom } from '../../hooks/useGetRoom';
|
||||
import { SpaceProvider } from '../../hooks/useSpace';
|
||||
import { CreateRoomForm } from './CreateRoom';
|
||||
@@ -49,7 +60,7 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
canonical: true,
|
||||
via: viaServers,
|
||||
},
|
||||
parentSubRoomId
|
||||
parentSubRoomId,
|
||||
);
|
||||
|
||||
// Set m.space.child on the parent room pointing to this sub-room
|
||||
@@ -57,19 +68,17 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
parentSubRoomId,
|
||||
StateEvent.SpaceChild,
|
||||
{ via: viaServers },
|
||||
newRoomId
|
||||
newRoomId,
|
||||
);
|
||||
|
||||
// Copy parent's join_rules to the sub-room
|
||||
const parentJoinRulesEvent = parentRoom.currentState.getStateEvents(StateEvent.RoomJoinRules, '');
|
||||
const parentJoinRulesEvent = parentRoom.currentState.getStateEvents(
|
||||
StateEvent.RoomJoinRules,
|
||||
'',
|
||||
);
|
||||
if (parentJoinRulesEvent) {
|
||||
const joinRulesContent = parentJoinRulesEvent.getContent();
|
||||
await mx.sendStateEvent(
|
||||
newRoomId,
|
||||
StateEvent.RoomJoinRules,
|
||||
joinRulesContent,
|
||||
''
|
||||
);
|
||||
await mx.sendStateEvent(newRoomId, StateEvent.RoomJoinRules, joinRulesContent, '');
|
||||
}
|
||||
|
||||
// Add new room to parent's sub-rooms list
|
||||
@@ -80,7 +89,12 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
children: [...currentChildren, newRoomId],
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await mx.sendStateEvent(parentSubRoomId, StateEvent.PaarrotSubRooms as any, newContent, '');
|
||||
await mx.sendStateEvent(
|
||||
parentSubRoomId,
|
||||
StateEvent.PaarrotSubRooms as any,
|
||||
newContent,
|
||||
'',
|
||||
);
|
||||
|
||||
// Also add sub-room to parent's space(s) for joining/permissions
|
||||
// The UI will hide it from the top-level display and only show it nested
|
||||
@@ -101,14 +115,14 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
StateEvent.SpaceChild as any,
|
||||
{ via: spaceViaServers },
|
||||
newRoomId
|
||||
newRoomId,
|
||||
);
|
||||
} catch (spaceError) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Failed to add sub-room to space ${parentSpaceId}:`, spaceError);
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -118,7 +132,7 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
}
|
||||
closeDialog();
|
||||
},
|
||||
[mx, parentSubRoomId, parentRoom, roomToParents, closeDialog]
|
||||
[mx, parentSubRoomId, parentRoom, roomToParents, closeDialog],
|
||||
);
|
||||
|
||||
const modalTitle = parentSubRoomId ? 'New Sub-Room' : 'New Room';
|
||||
|
||||
Reference in New Issue
Block a user