From b4b0c4c6dfd944346e7ea82bc607e2f83fcf228a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 9 Apr 2020 15:14:07 -0600 Subject: [PATCH] Add comments to highlight where we'll need m.widget support For https://github.com/vector-im/riot-web/issues/13111 --- src/ScalarMessaging.js | 2 ++ src/TextForEvent.js | 1 + src/components/views/rooms/EventTile.js | 1 + .../views/settings/tabs/room/RolesRoomSettingsTab.js | 2 ++ src/stores/ActiveWidgetStore.js | 1 + src/utils/WidgetUtils.js | 7 +++++-- test/components/views/rooms/RoomSettings-test.js | 1 + 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ScalarMessaging.js b/src/ScalarMessaging.js index 2211e513c3..ca8ca103e1 100644 --- a/src/ScalarMessaging.js +++ b/src/ScalarMessaging.js @@ -172,6 +172,7 @@ Request: Response: [ { + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) type: "im.vector.modular.widgets", state_key: "wid1", content: { @@ -190,6 +191,7 @@ Example: room_id: "!foo:bar", response: [ { + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) type: "im.vector.modular.widgets", state_key: "wid1", content: { diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 6b1c1dcd2d..3607d7a676 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -603,6 +603,7 @@ const stateHandlers = { 'm.room.guest_access': textForGuestAccessEvent, 'm.room.related_groups': textForRelatedGroupsEvent, + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) 'im.vector.modular.widgets': textForWidgetEvent, }; diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index aed2d4b25b..75fbe5caa3 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -59,6 +59,7 @@ const stateEventTileTypes = { 'm.room.power_levels': 'messages.TextualEvent', 'm.room.pinned_events': 'messages.TextualEvent', 'm.room.server_acl': 'messages.TextualEvent', + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) 'im.vector.modular.widgets': 'messages.TextualEvent', 'm.room.tombstone': 'messages.TextualEvent', 'm.room.join_rules': 'messages.TextualEvent', diff --git a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js index a3a9cb78c5..b812bb6b68 100644 --- a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js @@ -33,6 +33,7 @@ const plEventsToLabels = { "m.room.tombstone": _td("Upgrade the room"), "m.room.encryption": _td("Enable room encryption"), + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) "im.vector.modular.widgets": _td("Modify widgets"), }; @@ -47,6 +48,7 @@ const plEventsToShow = { "m.room.tombstone": {isState: true}, "m.room.encryption": {isState: true}, + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) "im.vector.modular.widgets": {isState: true}, }; diff --git a/src/stores/ActiveWidgetStore.js b/src/stores/ActiveWidgetStore.js index 60ea3f9106..c6f8dc69b7 100644 --- a/src/stores/ActiveWidgetStore.js +++ b/src/stores/ActiveWidgetStore.js @@ -64,6 +64,7 @@ class ActiveWidgetStore extends EventEmitter { // Everything else relies on views listening for events and calling setters // on this class which is terrible. This store should just listen for events // and keep itself up to date. + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) if (ev.getType() !== 'im.vector.modular.widgets') return; if (ev.getStateKey() === this._persistentWidgetId) { diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 9fb6358c1f..6768119d8f 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -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 []; diff --git a/test/components/views/rooms/RoomSettings-test.js b/test/components/views/rooms/RoomSettings-test.js index 5e21f729d0..b3790b2507 100644 --- a/test/components/views/rooms/RoomSettings-test.js +++ b/test/components/views/rooms/RoomSettings-test.js @@ -177,6 +177,7 @@ describe.skip('RoomSettings', () => { 'm.room.history_visibility': 50, 'm.room.power_levels': 50, 'm.room.topic': 50, + // TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111) 'im.vector.modular.widgets': 50, }, },