From ab103d3038b0bf05260fd6a544ec764148157ea6 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Thu, 25 Apr 2024 21:57:51 -0500 Subject: [PATCH] request capability on start --- frontend/src/Widget.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/Widget.jsx b/frontend/src/Widget.jsx index 45ef910..4220eee 100644 --- a/frontend/src/Widget.jsx +++ b/frontend/src/Widget.jsx @@ -277,6 +277,13 @@ function Widget() { }); widgetApi.current.start(); + + const sendMessageCapability = WidgetEventCapability.forRoomEvent( + EventDirection.Send, + 'm.room.message', + ); + widgetApi.current.requestCapability(sendMessageCapability.raw); + widgetApi.current.updateRequestedCapabilities(); }, []); /* -------------------------------------------------------------------------------- */ @@ -363,12 +370,6 @@ function Widget() { // TODO: Sign and send a message to the forum-api bot / to a room in matrix const registerMatrixIdentity = async () => { - const sendMessageCapability = WidgetEventCapability.forRoomEvent( - EventDirection.Send, - 'm.room.message', - ); - widgetApi.current.requestCapability(sendMessageCapability.raw); - await widgetApi.current.updateRequestedCapabilities(); if (widgetApi.current.hasCapability(sendMessageCapability)) { await widgetApi.current.sendRoomEvent('m.message', 'test message', '!HMoNkuTRLqQGhhlMNO:matrix.dgov.io'); } else {