Skip to content

Commit bd3cf60

Browse files
committed
Check for server support on state future send
Needed because this check is otherwise lost by the override
1 parent 1123c64 commit bd3cf60

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
@@ -531,7 +531,7 @@ export const UNSTABLE_MSC2666_SHARED_ROOMS = "uk.half-shot.msc2666";
531531
export const UNSTABLE_MSC2666_MUTUAL_ROOMS = "uk.half-shot.msc2666.mutual_rooms";
532532
export const UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS = "uk.half-shot.msc2666.query_mutual_rooms";
533533

534-
const UNSTABLE_MSC4140_FUTURES = "org.matrix.msc4140";
534+
export const UNSTABLE_MSC4140_FUTURES = "org.matrix.msc4140";
535535

536536
enum CrossSigningKeyType {
537537
MasterKey = "master_key",

src/embedded.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
IStartClientOpts,
3737
SendToDeviceContentMap,
3838
IOpenIDToken,
39+
UNSTABLE_MSC4140_FUTURES,
3940
} from "./client";
4041
import { SyncApi, SyncState } from "./sync";
4142
import { SlidingSyncSdk } from "./sliding-sync-sdk";
@@ -313,6 +314,10 @@ export class RoomWidgetClient extends MatrixClient {
313314
content: StateEvents[K],
314315
stateKey = "",
315316
): Promise<SendFutureResponse> {
317+
if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_FUTURES))) {
318+
throw Error("Server does not support the Futures API");
319+
}
320+
316321
// TODO: better type checking
317322
return (await this.widgetApi.sendStateEvent(
318323
eventType,

0 commit comments

Comments
 (0)