Read integration managers from account data
For https://github.com/vector-im/riot-web/issues/4913 / https://github.com/vector-im/riot-web/issues/10161 Relies on the structure defined by [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957) This is just the bit of code to parse the user's widgets (while watching for changes) and allow for it to be the default manager.
This commit is contained in:
parent
4c82d16e34
commit
74ce5c3541
3 changed files with 60 additions and 2 deletions
|
@ -340,6 +340,17 @@ export default class WidgetUtils {
|
|||
return widgets.filter((widget) => widget.content && widget.content.type === "m.stickerpicker");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all integration manager widgets for this user.
|
||||
* @returns {Object[]} An array of integration manager user widgets.
|
||||
*/
|
||||
static getIntegrationManagerWidgets() {
|
||||
const widgets = WidgetUtils.getUserWidgetsArray();
|
||||
// We'll be using im.vector.integration_manager until MSC1957 or similar is accepted.
|
||||
const imTypes = ["m.integration_manager", "im.vector.integration_manager"];
|
||||
return widgets.filter(w => w.content && imTypes.includes(w.content.type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all stickerpicker widgets (stickerpickers are user widgets by nature)
|
||||
* @return {Promise} Resolves on account data updated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue