@@ -311,8 +311,9 @@ export class RoomWidgetClient extends MatrixClient {
311311 throw e ;
312312 }
313313
314+ // This also checks for an event id on the response
314315 room . updatePendingEvent ( event , EventStatus . SENT , response . event_id ) ;
315- return this . validateSendEventResponse ( response ) ;
316+ return { event_id : response . event_id ! } ;
316317 }
317318
318319 public async sendStateEvent (
@@ -322,7 +323,10 @@ export class RoomWidgetClient extends MatrixClient {
322323 stateKey = "" ,
323324 ) : Promise < ISendEventResponse > {
324325 const response = await this . widgetApi . sendStateEvent ( eventType , stateKey , content , roomId ) ;
325- return this . validateSendEventResponse ( response ) ;
326+ if ( response . event_id === undefined ) {
327+ throw new Error ( "'event_id' absent from response to an event request" ) ;
328+ }
329+ return { event_id : response . event_id } ;
326330 }
327331
328332 /**
@@ -351,13 +355,6 @@ export class RoomWidgetClient extends MatrixClient {
351355 return this . validateSendDelayedEventResponse ( response ) ;
352356 }
353357
354- private validateSendEventResponse ( response : ISendEventFromWidgetResponseData ) : ISendEventResponse {
355- if ( response . event_id === undefined ) {
356- throw new Error ( "'event_id' absent from response to an event request" ) ;
357- }
358- return { event_id : response . event_id } ;
359- }
360-
361358 private validateSendDelayedEventResponse ( response : ISendEventFromWidgetResponseData ) : SendDelayedEventResponse {
362359 if ( response . delay_id === undefined ) {
363360 throw new Error ( "'delay_id' absent from response to a delayed event request" ) ;
0 commit comments