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:
Andrew Ferrazzutti
2024-04-15 23:20:20 +09:00
parent 4da20b6c3a
commit b663cb48d8
4 changed files with 12 additions and 30 deletions

View File

@@ -62,7 +62,7 @@
"i18next-http-backend": "^2.0.0",
"livekit-client": "^2.0.2",
"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",
"normalize.css": "^8.0.1",
"pako": "^2.0.4",

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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"
integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#4f628bf64c6589066a014513431cd1efe35c0615":
version "31.6.1"
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/4f628bf64c6589066a014513431cd1efe35c0615"
"matrix-js-sdk@github:AndrewFerr/matrix-js-sdk#msc-3266-compliance":
version "32.0.0"
resolved "https://codeload.github.com/AndrewFerr/matrix-js-sdk/tar.gz/5cff292a0b6284714eab1b9498f422dd3d737ea1"
dependencies:
"@babel/runtime" "^7.12.5"
"@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0"