mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
More code re-use
This commit is contained in:
parent
ca8a4a0c3f
commit
b6f3b2f594
1 changed files with 3 additions and 11 deletions
|
@ -360,17 +360,9 @@ function getWidgets(event, roomId) {
|
||||||
sendError(event, _t('This room is not recognised.'));
|
sendError(event, _t('This room is not recognised.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO - Room widgets need to be moved to 'm.widget' state events
|
// XXX: This gets the raw event object (I think because we can't
|
||||||
// https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing
|
// send the MatrixEvent over postMessage?)
|
||||||
const stateEvents = room.currentState.getStateEvents("im.vector.modular.widgets");
|
widgetStateEvents = WidgetUtils.getRoomWidgets(room).map((ev) => ev.event);
|
||||||
// Only return widgets which have required fields
|
|
||||||
if (room) {
|
|
||||||
stateEvents.forEach((ev) => {
|
|
||||||
if (ev.getContent().type && ev.getContent().url) {
|
|
||||||
widgetStateEvents.push(ev.event); // return the raw event
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add user widgets (not linked to a specific room)
|
// Add user widgets (not linked to a specific room)
|
||||||
|
|
Loading…
Reference in a new issue