mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +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:
@@ -62,7 +62,7 @@
|
|||||||
"i18next-http-backend": "^2.0.0",
|
"i18next-http-backend": "^2.0.0",
|
||||||
"livekit-client": "^2.0.2",
|
"livekit-client": "^2.0.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#4f628bf64c6589066a014513431cd1efe35c0615",
|
"matrix-js-sdk": "github:AndrewFerr/matrix-js-sdk#msc-3266-compliance",
|
||||||
"matrix-widget-api": "^1.3.1",
|
"matrix-widget-api": "^1.3.1",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"pako": "^2.0.4",
|
"pako": "^2.0.4",
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export const RoomPage: FC = () => {
|
|||||||
userId: client!.getUserId() ?? "",
|
userId: client!.getUserId() ?? "",
|
||||||
displayName: userDisplayName ?? "",
|
displayName: userDisplayName ?? "",
|
||||||
avatarUrl: avatarUrl ?? "",
|
avatarUrl: avatarUrl ?? "",
|
||||||
roomAlias: groupCallState.roomSummary.canonical_alias ?? "",
|
roomAlias: null,
|
||||||
roomId: groupCallState.roomSummary.room_id,
|
roomId: groupCallState.roomSummary.room_id,
|
||||||
roomName: groupCallState.roomSummary.name ?? "",
|
roomName: groupCallState.roomSummary.name ?? "",
|
||||||
roomAvatar: groupCallState.roomSummary.avatar_url ?? null,
|
roomAvatar: groupCallState.roomSummary.avatar_url ?? null,
|
||||||
|
|||||||
@@ -17,11 +17,15 @@ limitations under the License.
|
|||||||
import { useState, useEffect, useRef, useCallback } from "react";
|
import { useState, useEffect, useRef, useCallback } from "react";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
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 { SyncState } from "matrix-js-sdk/src/sync";
|
||||||
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
||||||
import { RoomEvent, Room } from "matrix-js-sdk/src/models/room";
|
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 { JoinRule } from "matrix-js-sdk";
|
||||||
import { useTranslation } from "react-i18next";
|
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 = (
|
export const useLoadGroupCall = (
|
||||||
client: MatrixClient,
|
client: MatrixClient,
|
||||||
roomIdOrAlias: string,
|
roomIdOrAlias: string,
|
||||||
@@ -215,12 +202,7 @@ export const useLoadGroupCall = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
// If the room does not exist we first search for it with viaServers
|
// 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);
|
||||||
const roomSummary = (await client.getRoomSummary(
|
|
||||||
roomId,
|
|
||||||
viaServers,
|
|
||||||
)) as unknown as RoomSummary;
|
|
||||||
|
|
||||||
if (room?.getMyMembership() === KnownMembership.Ban) {
|
if (room?.getMyMembership() === KnownMembership.Ban) {
|
||||||
throw bannedError();
|
throw bannedError();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -6298,9 +6298,9 @@ matrix-events-sdk@0.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd"
|
resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd"
|
||||||
integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==
|
integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==
|
||||||
|
|
||||||
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#4f628bf64c6589066a014513431cd1efe35c0615":
|
"matrix-js-sdk@github:AndrewFerr/matrix-js-sdk#msc-3266-compliance":
|
||||||
version "31.6.1"
|
version "32.0.0"
|
||||||
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/4f628bf64c6589066a014513431cd1efe35c0615"
|
resolved "https://codeload.github.com/AndrewFerr/matrix-js-sdk/tar.gz/5cff292a0b6284714eab1b9498f422dd3d737ea1"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0"
|
"@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user