You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user