mirror of
https://github.com/vector-im/element-call.git
synced 2026-04-06 07:20:25 +00:00
Use (unmerged!) RoomSummary type from the js-sdk
Temporarily change the js-sdk dependency to the PR branch that provides that type
This commit is contained in:
@@ -122,7 +122,7 @@ export const RoomPage: FC = () => {
|
||||
userId: client!.getUserId() ?? "",
|
||||
displayName: userDisplayName ?? "",
|
||||
avatarUrl: avatarUrl ?? "",
|
||||
roomAlias: groupCallState.roomSummary.canonical_alias ?? "",
|
||||
roomAlias: null,
|
||||
roomId: groupCallState.roomSummary.room_id,
|
||||
roomName: groupCallState.roomSummary.name ?? "",
|
||||
roomAvatar: groupCallState.roomSummary.avatar_url ?? null,
|
||||
|
||||
@@ -17,11 +17,15 @@ limitations under the License.
|
||||
import { useState, useEffect, useRef, useCallback } from "react";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import {
|
||||
ClientEvent,
|
||||
MatrixClient,
|
||||
RoomSummary,
|
||||
} from "matrix-js-sdk/src/client";
|
||||
import { SyncState } from "matrix-js-sdk/src/sync";
|
||||
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
||||
import { RoomEvent, Room } from "matrix-js-sdk/src/models/room";
|
||||
import { KnownMembership, Membership, RoomType } from "matrix-js-sdk/src/types";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
import { JoinRule } from "matrix-js-sdk";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -73,23 +77,6 @@ export class CustomMessage extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
// RoomSummary from the js-sdk (this is not public so we copy it here)
|
||||
export interface RoomSummary {
|
||||
room_id: string;
|
||||
name?: string;
|
||||
avatar_url?: string;
|
||||
topic?: string;
|
||||
canonical_alias?: string;
|
||||
aliases?: string[];
|
||||
world_readable: boolean;
|
||||
guest_can_join: boolean;
|
||||
num_joined_members: number;
|
||||
join_rule?: JoinRule.Knock | JoinRule.Public; // Added by MSC2403
|
||||
room_type?: RoomType;
|
||||
membership?: Membership;
|
||||
"im.nheko.summary.encryption"?: boolean;
|
||||
}
|
||||
|
||||
export const useLoadGroupCall = (
|
||||
client: MatrixClient,
|
||||
roomIdOrAlias: string,
|
||||
@@ -215,12 +202,7 @@ export const useLoadGroupCall = (
|
||||
);
|
||||
|
||||
// If the room does not exist we first search for it with viaServers
|
||||
// We need to cast it to our own RoomSummary interface since we use the im.nheko.summary.encryption field.
|
||||
const roomSummary = (await client.getRoomSummary(
|
||||
roomId,
|
||||
viaServers,
|
||||
)) as unknown as RoomSummary;
|
||||
|
||||
const roomSummary = await client.getRoomSummary(roomId, viaServers);
|
||||
if (room?.getMyMembership() === KnownMembership.Ban) {
|
||||
throw bannedError();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user