Eliminate the use of MatrixClientPeg in utils (#10910)
This commit is contained in:
parent
a0c2676c38
commit
30429df948
108 changed files with 409 additions and 325 deletions
|
@ -411,6 +411,7 @@ function kickUser(event: MessageEvent<any>, roomId: string, userId: string): voi
|
|||
}
|
||||
|
||||
function setWidget(event: MessageEvent<any>, roomId: string | null): void {
|
||||
const client = MatrixClientPeg.get();
|
||||
const widgetId = event.data.widget_id;
|
||||
let widgetType = event.data.type;
|
||||
const widgetUrl = event.data.url;
|
||||
|
@ -458,7 +459,7 @@ function setWidget(event: MessageEvent<any>, roomId: string | null): void {
|
|||
widgetType = WidgetType.fromString(widgetType);
|
||||
|
||||
if (userWidget) {
|
||||
WidgetUtils.setUserWidget(widgetId, widgetType, widgetUrl, widgetName, widgetData)
|
||||
WidgetUtils.setUserWidget(client, widgetId, widgetType, widgetUrl, widgetName, widgetData)
|
||||
.then(() => {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
|
@ -476,6 +477,7 @@ function setWidget(event: MessageEvent<any>, roomId: string | null): void {
|
|||
return;
|
||||
}
|
||||
WidgetUtils.setRoomWidget(
|
||||
client,
|
||||
roomId,
|
||||
widgetId,
|
||||
widgetType,
|
||||
|
@ -516,7 +518,7 @@ function getWidgets(event: MessageEvent<any>, roomId: string | null): void {
|
|||
}
|
||||
|
||||
// Add user widgets (not linked to a specific room)
|
||||
const userWidgets = WidgetUtils.getUserWidgetsArray();
|
||||
const userWidgets = WidgetUtils.getUserWidgetsArray(client);
|
||||
widgetStateEvents = widgetStateEvents.concat(userWidgets);
|
||||
|
||||
sendResponse(event, widgetStateEvents);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue