Delayed event management: split endpoints, no auth (#31183)

* Delayed event management: split endpoints, no auth

Use the new js-sdk client methods for calling the dedicated,
unauthenticated endpoints for each of the cancel/restart/send actions
for updating a delayed event.

Note that these methods are compatible with homeservers that support
only the original endpoint where the update action is in the request
body.

* REPLACEME: pull in dependant js-sdk branch

see matrix-org/matrix-js-sdk#5066

* Format with Prettier

* Update matrix-js-sdk
This commit is contained in:
Andrew Ferrazzutti
2025-11-17 11:18:25 -05:00
committed by GitHub
parent 250d6571fe
commit fcd23b48e0
5 changed files with 65 additions and 27 deletions

View File

@@ -26,7 +26,6 @@ import {
type IWidgetApiErrorResponseDataDetails,
type ISearchUserDirectoryResult,
type IGetMediaConfigResult,
type UpdateDelayedEventAction,
} from "matrix-widget-api";
import {
ClientEvent,
@@ -425,12 +424,34 @@ export class StopGapWidgetDriver extends WidgetDriver {
/**
* @experimental Part of MSC4140 & MSC4157
*/
public async updateDelayedEvent(delayId: string, action: UpdateDelayedEventAction): Promise<void> {
public async cancelScheduledDelayedEvent(delayId: string): Promise<void> {
const client = MatrixClientPeg.get();
if (!client) throw new Error("Not in a room or not attached to a client");
await client._unstable_updateDelayedEvent(delayId, action);
await client._unstable_cancelScheduledDelayedEvent(delayId);
}
/**
* @experimental Part of MSC4140 & MSC4157
*/
public async restartScheduledDelayedEvent(delayId: string): Promise<void> {
const client = MatrixClientPeg.get();
if (!client) throw new Error("Not in a room or not attached to a client");
await client._unstable_restartScheduledDelayedEvent(delayId);
}
/**
* @experimental Part of MSC4140 & MSC4157
*/
public async sendScheduledDelayedEvent(delayId: string): Promise<void> {
const client = MatrixClientPeg.get();
if (!client) throw new Error("Not in a room or not attached to a client");
await client._unstable_sendScheduledDelayedEvent(delayId);
}
/**