1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-07 10:46:24 +03:00

Move widget utility functions in to their own file.

This commit is contained in:
Richard Lewis
2018-01-11 10:32:37 +00:00
parent 52f28d09e0
commit 1a994b88f5
2 changed files with 59 additions and 4 deletions

View File

@@ -235,6 +235,7 @@ const SdkConfig = require('./SdkConfig');
const MatrixClientPeg = require("./MatrixClientPeg");
const MatrixEvent = require("matrix-js-sdk").MatrixEvent;
const dis = require("./dispatcher");
const Widgets = require('./utils/widgets');
import { _t } from './languageHandler';
function sendResponse(event, res) {
@@ -405,10 +406,8 @@ function getWidgets(event, roomId) {
}
// Add user widgets (not linked to a specific room)
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
const userWidgetArray = Object.keys(userWidgets).map((key) => userWidgets[key]);
widgetStateEvents = widgetStateEvents.concat(userWidgetArray);
console.warn('Sending user widgets', userWidgetArray);
const userWidgets = Widgets.getUserWidgets();
widgetStateEvents = widgetStateEvents.concat(userWidgets);
sendResponse(event, widgetStateEvents);
}