Merge pull request #4380 from matrix-org/travis/widget-complaints
Add comments to highlight where we'll need m.widget support
This commit is contained in:
commit
f0a2f5dd4f
7 changed files with 13 additions and 2 deletions
|
@ -172,6 +172,7 @@ Request:
|
||||||
Response:
|
Response:
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
|
||||||
type: "im.vector.modular.widgets",
|
type: "im.vector.modular.widgets",
|
||||||
state_key: "wid1",
|
state_key: "wid1",
|
||||||
content: {
|
content: {
|
||||||
|
@ -190,6 +191,7 @@ Example:
|
||||||
room_id: "!foo:bar",
|
room_id: "!foo:bar",
|
||||||
response: [
|
response: [
|
||||||
{
|
{
|
||||||
|
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
|
||||||
type: "im.vector.modular.widgets",
|
type: "im.vector.modular.widgets",
|
||||||
state_key: "wid1",
|
state_key: "wid1",
|
||||||
content: {
|
content: {
|
||||||
|
|
|
@ -603,6 +603,7 @@ const stateHandlers = {
|
||||||
'm.room.guest_access': textForGuestAccessEvent,
|
'm.room.guest_access': textForGuestAccessEvent,
|
||||||
'm.room.related_groups': textForRelatedGroupsEvent,
|
'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,
|
'im.vector.modular.widgets': textForWidgetEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ const stateEventTileTypes = {
|
||||||
'm.room.power_levels': 'messages.TextualEvent',
|
'm.room.power_levels': 'messages.TextualEvent',
|
||||||
'm.room.pinned_events': 'messages.TextualEvent',
|
'm.room.pinned_events': 'messages.TextualEvent',
|
||||||
'm.room.server_acl': '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',
|
'im.vector.modular.widgets': 'messages.TextualEvent',
|
||||||
'm.room.tombstone': 'messages.TextualEvent',
|
'm.room.tombstone': 'messages.TextualEvent',
|
||||||
'm.room.join_rules': 'messages.TextualEvent',
|
'm.room.join_rules': 'messages.TextualEvent',
|
||||||
|
|
|
@ -33,6 +33,7 @@ const plEventsToLabels = {
|
||||||
"m.room.tombstone": _td("Upgrade the room"),
|
"m.room.tombstone": _td("Upgrade the room"),
|
||||||
"m.room.encryption": _td("Enable room encryption"),
|
"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"),
|
"im.vector.modular.widgets": _td("Modify widgets"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ const plEventsToShow = {
|
||||||
"m.room.tombstone": {isState: true},
|
"m.room.tombstone": {isState: true},
|
||||||
"m.room.encryption": {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},
|
"im.vector.modular.widgets": {isState: true},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ class ActiveWidgetStore extends EventEmitter {
|
||||||
// Everything else relies on views listening for events and calling setters
|
// Everything else relies on views listening for events and calling setters
|
||||||
// on this class which is terrible. This store should just listen for events
|
// on this class which is terrible. This store should just listen for events
|
||||||
// and keep itself up to date.
|
// 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.getType() !== 'im.vector.modular.widgets') return;
|
||||||
|
|
||||||
if (ev.getStateKey() === this._persistentWidgetId) {
|
if (ev.getStateKey() === this._persistentWidgetId) {
|
||||||
|
|
|
@ -66,6 +66,7 @@ export default class WidgetUtils {
|
||||||
return false;
|
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);
|
return room.currentState.maySendStateEvent('im.vector.modular.widgets', me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +181,7 @@ export default class WidgetUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
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');
|
const startingWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
||||||
if (eventsInIntendedState(startingWidgetEvents)) {
|
if (eventsInIntendedState(startingWidgetEvents)) {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -189,6 +191,7 @@ export default class WidgetUtils {
|
||||||
function onRoomStateEvents(ev) {
|
function onRoomStateEvents(ev) {
|
||||||
if (ev.getRoomId() !== roomId) return;
|
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');
|
const currentWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
||||||
|
|
||||||
if (eventsInIntendedState(currentWidgetEvents)) {
|
if (eventsInIntendedState(currentWidgetEvents)) {
|
||||||
|
@ -268,8 +271,7 @@ export default class WidgetUtils {
|
||||||
WidgetEchoStore.setRoomWidgetEcho(roomId, widgetId, content);
|
WidgetEchoStore.setRoomWidgetEcho(roomId, widgetId, content);
|
||||||
|
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
// TODO - Room widgets need to be moved to 'm.widget' state events
|
// TODO: Enable support for m.widget event type (https://github.com/vector-im/riot-web/issues/13111)
|
||||||
// https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing
|
|
||||||
return client.sendStateEvent(roomId, "im.vector.modular.widgets", content, widgetId).then(() => {
|
return client.sendStateEvent(roomId, "im.vector.modular.widgets", content, widgetId).then(() => {
|
||||||
return WidgetUtils.waitForRoomWidget(widgetId, roomId, addingWidget);
|
return WidgetUtils.waitForRoomWidget(widgetId, roomId, addingWidget);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
@ -283,6 +285,7 @@ export default class WidgetUtils {
|
||||||
* @return {[object]} Array containing current / active room widgets
|
* @return {[object]} Array containing current / active room widgets
|
||||||
*/
|
*/
|
||||||
static getRoomWidgets(room) {
|
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');
|
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
||||||
if (!appsStateEvents) {
|
if (!appsStateEvents) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -177,6 +177,7 @@ describe.skip('RoomSettings', () => {
|
||||||
'm.room.history_visibility': 50,
|
'm.room.history_visibility': 50,
|
||||||
'm.room.power_levels': 50,
|
'm.room.power_levels': 50,
|
||||||
'm.room.topic': 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,
|
'im.vector.modular.widgets': 50,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue