diff --git a/src/client.ts b/src/client.ts index 82fd049273c..ec7457ed38c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5796,16 +5796,17 @@ export class MatrixClient extends TypedEventEmitter { - const promise = this.membershipChange(roomId, undefined, "forget"); - if (!deleteRoom) { - return promise; - } - return promise.then((response) => { + public async forget(roomId: string, deleteRoom = true): Promise<{}> { + // API returns an empty object + const path = utils.encodeUri("/rooms/$room_id/forget", { + $room_id: roomId, + }); + const response = await this.http.authedRequest<{}>(Method.Post, path); + if (deleteRoom) { this.store.removeRoom(roomId); this.emit(ClientEvent.DeleteRoom, roomId); - return response; - }); + } + return response; } /** @@ -5846,7 +5847,7 @@ export class MatrixClient extends TypedEventEmitter { // API returns an empty object