Skip to content

Commit 61cbda2

Browse files
committed
Check for server support on state future send
Needed because this check is otherwise lost by the override
1 parent 16234c2 commit 61cbda2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export const UNSTABLE_MSC2666_SHARED_ROOMS = "uk.half-shot.msc2666";
530530
export const UNSTABLE_MSC2666_MUTUAL_ROOMS = "uk.half-shot.msc2666.mutual_rooms";
531531
export const UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS = "uk.half-shot.msc2666.query_mutual_rooms";
532532

533-
const UNSTABLE_MSC4140_FUTURES = "org.matrix.msc4140";
533+
export const UNSTABLE_MSC4140_FUTURES = "org.matrix.msc4140";
534534

535535
enum CrossSigningKeyType {
536536
MasterKey = "master_key",

src/embedded.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
IStartClientOpts,
4343
SendToDeviceContentMap,
4444
IOpenIDToken,
45+
UNSTABLE_MSC4140_FUTURES,
4546
} from "./client";
4647
import { SyncApi, SyncState } from "./sync";
4748
import { SlidingSyncSdk } from "./sliding-sync-sdk";
@@ -330,6 +331,10 @@ export class RoomWidgetClient extends MatrixClient {
330331
content: StateEvents[K],
331332
stateKey = "",
332333
): Promise<SendFutureResponse<F>> {
334+
if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_FUTURES))) {
335+
throw Error("Server does not support the Futures API");
336+
}
337+
333338
// TODO: better type checking
334339
return (await this.widgetApi.sendStateEvent(
335340
eventType,

0 commit comments

Comments
 (0)