Update some more
parent
a645cebb49
commit
33dca81352
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { IFieldType, IInstance, IProtocol, IPublicRoomsChunk } from "matrix-js-sdk/src/client";
|
import { IFieldType, IInstance, IProtocol, IPublicRoomsChunkRoom } from "matrix-js-sdk/src/client";
|
||||||
import { Visibility } from "matrix-js-sdk/src/@types/partials";
|
import { Visibility } from "matrix-js-sdk/src/@types/partials";
|
||||||
import { IRoomDirectoryOptions } from "matrix-js-sdk/src/@types/requests";
|
import { IRoomDirectoryOptions } from "matrix-js-sdk/src/@types/requests";
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ interface IProps extends IDialogProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
publicRooms: IPublicRoomsChunk[];
|
publicRooms: IPublicRoomsChunkRoom[];
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
protocolsLoading: boolean;
|
protocolsLoading: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
@ -304,7 +304,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
* HS admins to do this through the RoomSettings interface, but
|
* HS admins to do this through the RoomSettings interface, but
|
||||||
* this needs SPEC-417.
|
* this needs SPEC-417.
|
||||||
*/
|
*/
|
||||||
private removeFromDirectory(room: IPublicRoomsChunk) {
|
private removeFromDirectory(room: IPublicRoomsChunkRoom) {
|
||||||
const alias = getDisplayAliasForRoom(room);
|
const alias = getDisplayAliasForRoom(room);
|
||||||
const name = room.name || alias || _t('Unnamed room');
|
const name = room.name || alias || _t('Unnamed room');
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomClicked = (room: IPublicRoomsChunk, ev: ButtonEvent) => {
|
private onRoomClicked = (room: IPublicRoomsChunkRoom, ev: ButtonEvent) => {
|
||||||
// If room was shift-clicked, remove it from the room directory
|
// If room was shift-clicked, remove it from the room directory
|
||||||
if (ev.shiftKey && !this.state.selectedCommunityId) {
|
if (ev.shiftKey && !this.state.selectedCommunityId) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -459,17 +459,17 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onPreviewClick = (ev: ButtonEvent, room: IPublicRoomsChunk) => {
|
private onPreviewClick = (ev: ButtonEvent, room: IPublicRoomsChunkRoom) => {
|
||||||
this.showRoom(room, null, false, true);
|
this.showRoom(room, null, false, true);
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
private onViewClick = (ev: ButtonEvent, room: IPublicRoomsChunk) => {
|
private onViewClick = (ev: ButtonEvent, room: IPublicRoomsChunkRoom) => {
|
||||||
this.showRoom(room);
|
this.showRoom(room);
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
private onJoinClick = (ev: ButtonEvent, room: IPublicRoomsChunk) => {
|
private onJoinClick = (ev: ButtonEvent, room: IPublicRoomsChunkRoom) => {
|
||||||
this.showRoom(room, null, true);
|
this.showRoom(room, null, true);
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
};
|
};
|
||||||
|
@ -487,7 +487,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
this.showRoom(null, alias, autoJoin);
|
this.showRoom(null, alias, autoJoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private showRoom(room: IPublicRoomsChunk, roomAlias?: string, autoJoin = false, shouldPeek = false) {
|
private showRoom(room: IPublicRoomsChunkRoom, roomAlias?: string, autoJoin = false, shouldPeek = false) {
|
||||||
this.onFinished();
|
this.onFinished();
|
||||||
const payload: ActionPayload = {
|
const payload: ActionPayload = {
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
|
@ -536,7 +536,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
dis.dispatch(payload);
|
dis.dispatch(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
private createRoomCells(room: IPublicRoomsChunk) {
|
private createRoomCells(room: IPublicRoomsChunkRoom) {
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
const clientRoom = client.getRoom(room.room_id);
|
const clientRoom = client.getRoom(room.room_id);
|
||||||
const hasJoinedRoom = clientRoom && clientRoom.getMyMembership() === "join";
|
const hasJoinedRoom = clientRoom && clientRoom.getMyMembership() === "join";
|
||||||
|
@ -832,6 +832,6 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
// Similar to matrix-react-sdk's MatrixTools.getDisplayAliasForRoom
|
// Similar to matrix-react-sdk's MatrixTools.getDisplayAliasForRoom
|
||||||
// but works with the objects we get from the public room list
|
// but works with the objects we get from the public room list
|
||||||
function getDisplayAliasForRoom(room: IPublicRoomsChunk) {
|
function getDisplayAliasForRoom(room: IPublicRoomsChunkRoom) {
|
||||||
return room.canonical_alias || room.aliases?.[0] || "";
|
return room.canonical_alias || room.aliases?.[0] || "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ interface IProps {
|
||||||
hasAvatar: boolean;
|
hasAvatar: boolean;
|
||||||
noAvatarLabel?: string;
|
noAvatarLabel?: string;
|
||||||
hasAvatarLabel?: string;
|
hasAvatarLabel?: string;
|
||||||
setAvatarUrl(url: string): Promise<any>;
|
setAvatarUrl(url: string): Promise<unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MiniAvatarUploader: React.FC<IProps> = ({ hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, children }) => {
|
const MiniAvatarUploader: React.FC<IProps> = ({ hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, children }) => {
|
||||||
|
|
|
@ -39,7 +39,7 @@ enum SpaceVisibility {
|
||||||
|
|
||||||
const useLocalEcho = <T extends any>(
|
const useLocalEcho = <T extends any>(
|
||||||
currentFactory: () => T,
|
currentFactory: () => T,
|
||||||
setterFn: (value: T) => Promise<any>,
|
setterFn: (value: T) => Promise<unknown>,
|
||||||
errorFn: (error: Error) => void,
|
errorFn: (error: Error) => void,
|
||||||
): [value: T, handler: (value: T) => void] => {
|
): [value: T, handler: (value: T) => void] => {
|
||||||
const [value, setValue] = useState(currentFactory);
|
const [value, setValue] = useState(currentFactory);
|
||||||
|
|
Loading…
Reference in New Issue