Add comments to highlight where we'll need m.widget support

For https://github.com/vector-im/riot-web/issues/13111
This commit is contained in:
Travis Ralston 2020-04-09 15:14:07 -06:00
parent 4d461c6d87
commit b4b0c4c6df
7 changed files with 13 additions and 2 deletions

View file

@ -66,6 +66,7 @@ export default class WidgetUtils {
return false;
}
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
return room.currentState.maySendStateEvent('im.vector.modular.widgets', me);
}
@ -180,6 +181,7 @@ export default class WidgetUtils {
}
const room = MatrixClientPeg.get().getRoom(roomId);
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
const startingWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
if (eventsInIntendedState(startingWidgetEvents)) {
resolve();
@ -189,6 +191,7 @@ export default class WidgetUtils {
function onRoomStateEvents(ev) {
if (ev.getRoomId() !== roomId) return;
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
const currentWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
if (eventsInIntendedState(currentWidgetEvents)) {
@ -268,8 +271,7 @@ export default class WidgetUtils {
WidgetEchoStore.setRoomWidgetEcho(roomId, widgetId, content);
const client = MatrixClientPeg.get();
// TODO - Room widgets need to be moved to 'm.widget' state events
// https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
return client.sendStateEvent(roomId, "im.vector.modular.widgets", content, widgetId).then(() => {
return WidgetUtils.waitForRoomWidget(widgetId, roomId, addingWidget);
}).finally(() => {
@ -283,6 +285,7 @@ export default class WidgetUtils {
* @return {[object]} Array containing current / active room widgets
*/
static getRoomWidgets(room) {
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
if (!appsStateEvents) {
return [];