You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-20 16:22:28 +03:00
Intercept cases of disabled/no integration managers
We already intercepted most of the cases where no integration manager was present, though there was a bug in many components where openAll() would be called regardless of an integration manager being available. The integration manager being disabled by the user is handled in the IntegrationManager classes rather than on click because we have quite a few calls to these functions. The StickerPicker is an exception because it does slightly different behaviour. This also removes the old "no integration manager configured" state from the IntegrationManager component as it is now replaced by a dialog.
This commit is contained in:
@@ -22,6 +22,10 @@ import type {MatrixClient, MatrixEvent, Room} from "matrix-js-sdk";
|
||||
import WidgetUtils from "../utils/WidgetUtils";
|
||||
import MatrixClientPeg from "../MatrixClientPeg";
|
||||
import {AutoDiscovery} from "matrix-js-sdk";
|
||||
import {_t} from "../languageHandler";
|
||||
import dis from "../dispatcher";
|
||||
import React from 'react';
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
|
||||
const HS_MANAGERS_REFRESH_INTERVAL = 8 * 60 * 60 * 1000; // 8 hours
|
||||
const KIND_PREFERENCE = [
|
||||
@@ -172,14 +176,19 @@ export class IntegrationManagers {
|
||||
}
|
||||
|
||||
openNoManagerDialog(): void {
|
||||
const IntegrationManager = sdk.getComponent("views.settings.IntegrationManager");
|
||||
Modal.createTrackedDialog(
|
||||
"Integration Manager", "None", IntegrationManager,
|
||||
{configured: false}, 'mx_IntegrationManager',
|
||||
);
|
||||
const IntegrationsImpossibleDialog = sdk.getComponent("dialogs.IntegrationsImpossibleDialog");
|
||||
Modal.createTrackedDialog('Integrations impossible', '', IntegrationsImpossibleDialog);
|
||||
}
|
||||
|
||||
openAll(room: Room = null, screen: string = null, integrationId: string = null): void {
|
||||
if (!SettingsStore.getValue("integrationProvisioning")) {
|
||||
return this.showDisabledDialog();
|
||||
}
|
||||
|
||||
if (this._managers.length === 0) {
|
||||
return this.openNoManagerDialog();
|
||||
}
|
||||
|
||||
const TabbedIntegrationManagerDialog = sdk.getComponent("views.dialogs.TabbedIntegrationManagerDialog");
|
||||
Modal.createTrackedDialog(
|
||||
'Tabbed Integration Manager', '', TabbedIntegrationManagerDialog,
|
||||
@@ -187,6 +196,11 @@ export class IntegrationManagers {
|
||||
);
|
||||
}
|
||||
|
||||
showDisabledDialog(): void {
|
||||
const IntegrationsDisabledDialog = sdk.getComponent("dialogs.IntegrationsDisabledDialog");
|
||||
Modal.createTrackedDialog('Integrations disabled', '', IntegrationsDisabledDialog);
|
||||
}
|
||||
|
||||
async overwriteManagerOnAccount(manager: IntegrationManagerInstance) {
|
||||
// TODO: TravisR - We should be logging out of scalar clients.
|
||||
await WidgetUtils.removeIntegrationManagerWidgets();
|
||||
|
||||
Reference in New Issue
Block a user