Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import url from 'url';
|
||||
import url from "url";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||
import ScalarAuthClient from "../ScalarAuthClient";
|
||||
import { dialogTermsInteractionCallback, TermsNotSignedError } from "../Terms";
|
||||
import Modal from '../Modal';
|
||||
import Modal from "../Modal";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import IntegrationManager from "../components/views/settings/IntegrationManager";
|
||||
import { IntegrationManagers } from "./IntegrationManagers";
|
||||
|
@ -52,8 +52,8 @@ export class IntegrationManagerInstance {
|
|||
|
||||
get trimmedApiUrl(): string {
|
||||
const parsed = url.parse(this.apiUrl);
|
||||
parsed.pathname = '';
|
||||
parsed.path = '';
|
||||
parsed.pathname = "";
|
||||
parsed.path = "";
|
||||
return url.format(parsed);
|
||||
}
|
||||
|
||||
|
@ -66,16 +66,14 @@ export class IntegrationManagerInstance {
|
|||
return IntegrationManagers.sharedInstance().showDisabledDialog();
|
||||
}
|
||||
|
||||
const dialog = Modal.createDialog(IntegrationManager, { loading: true }, 'mx_IntegrationManager');
|
||||
const dialog = Modal.createDialog(IntegrationManager, { loading: true }, "mx_IntegrationManager");
|
||||
|
||||
const client = this.getScalarClient();
|
||||
client.setTermsInteractionCallback((policyInfo, agreedUrls) => {
|
||||
// To avoid visual glitching of two modals stacking briefly, we customise the
|
||||
// terms dialog sizing when it will appear for the integration manager so that
|
||||
// it gets the same basic size as the integration manager's own modal.
|
||||
return dialogTermsInteractionCallback(
|
||||
policyInfo, agreedUrls, 'mx_TermsDialog_forIntegrationManager',
|
||||
);
|
||||
return dialogTermsInteractionCallback(policyInfo, agreedUrls, "mx_TermsDialog_forIntegrationManager");
|
||||
});
|
||||
|
||||
const newProps = {};
|
||||
|
@ -98,6 +96,6 @@ export class IntegrationManagerInstance {
|
|||
|
||||
// Close the old dialog and open a new one
|
||||
dialog.close();
|
||||
Modal.createDialog(IntegrationManager, newProps, 'mx_IntegrationManager');
|
||||
Modal.createDialog(IntegrationManager, newProps, "mx_IntegrationManager");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import url from 'url';
|
||||
import url from "url";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { compare } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import SdkConfig from '../SdkConfig';
|
||||
import Modal from '../Modal';
|
||||
import SdkConfig from "../SdkConfig";
|
||||
import Modal from "../Modal";
|
||||
import { IntegrationManagerInstance, Kind } from "./IntegrationManagerInstance";
|
||||
import IntegrationsImpossibleDialog from "../components/views/dialogs/IntegrationsImpossibleDialog";
|
||||
import IntegrationsDisabledDialog from "../components/views/dialogs/IntegrationsDisabledDialog";
|
||||
|
@ -85,24 +85,26 @@ export class IntegrationManagers {
|
|||
|
||||
private setupHomeserverManagers = async (discoveryResponse) => {
|
||||
logger.log("Updating homeserver-configured integration managers...");
|
||||
if (discoveryResponse && discoveryResponse['m.integrations']) {
|
||||
let managers = discoveryResponse['m.integrations']['managers'];
|
||||
if (discoveryResponse && discoveryResponse["m.integrations"]) {
|
||||
let managers = discoveryResponse["m.integrations"]["managers"];
|
||||
if (!Array.isArray(managers)) managers = []; // make it an array so we can wipe the HS managers
|
||||
|
||||
logger.log(`Homeserver has ${managers.length} integration managers`);
|
||||
|
||||
// Clear out any known managers for the homeserver
|
||||
// TODO: Log out of the scalar clients
|
||||
this.managers = this.managers.filter(m => m.kind !== Kind.Homeserver);
|
||||
this.managers = this.managers.filter((m) => m.kind !== Kind.Homeserver);
|
||||
|
||||
// Now add all the managers the homeserver wants us to have
|
||||
for (const hsManager of managers) {
|
||||
if (!hsManager["api_url"]) continue;
|
||||
this.managers.push(new IntegrationManagerInstance(
|
||||
Kind.Homeserver,
|
||||
hsManager["api_url"],
|
||||
hsManager["ui_url"], // optional
|
||||
));
|
||||
this.managers.push(
|
||||
new IntegrationManagerInstance(
|
||||
Kind.Homeserver,
|
||||
hsManager["api_url"],
|
||||
hsManager["ui_url"], // optional
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
this.primaryManager = null; // reset primary
|
||||
|
@ -114,19 +116,19 @@ export class IntegrationManagers {
|
|||
private setupAccountManagers() {
|
||||
if (!this.client || !this.client.getUserId()) return; // not logged in
|
||||
const widgets = WidgetUtils.getIntegrationManagerWidgets();
|
||||
widgets.forEach(w => {
|
||||
const data = w.content['data'];
|
||||
widgets.forEach((w) => {
|
||||
const data = w.content["data"];
|
||||
if (!data) return;
|
||||
|
||||
const uiUrl = w.content['url'];
|
||||
const apiUrl = data['api_url'] as string;
|
||||
const uiUrl = w.content["url"];
|
||||
const apiUrl = data["api_url"] as string;
|
||||
if (!apiUrl || !uiUrl) return;
|
||||
|
||||
const manager = new IntegrationManagerInstance(
|
||||
Kind.Account,
|
||||
apiUrl,
|
||||
uiUrl,
|
||||
w['id'] || w['state_key'] || '',
|
||||
w["id"] || w["state_key"] || "",
|
||||
);
|
||||
this.managers.push(manager);
|
||||
});
|
||||
|
@ -134,7 +136,7 @@ export class IntegrationManagers {
|
|||
}
|
||||
|
||||
private onAccountData = (ev: MatrixEvent): void => {
|
||||
if (ev.getType() === 'm.widgets') {
|
||||
if (ev.getType() === "m.widgets") {
|
||||
this.compileManagers();
|
||||
}
|
||||
};
|
||||
|
@ -146,7 +148,7 @@ export class IntegrationManagers {
|
|||
getOrderedManagers(): IntegrationManagerInstance[] {
|
||||
const ordered = [];
|
||||
for (const kind of KIND_PREFERENCE) {
|
||||
const managers = this.managers.filter(m => m.kind === kind);
|
||||
const managers = this.managers.filter((m) => m.kind === kind);
|
||||
if (!managers || !managers.length) continue;
|
||||
|
||||
if (kind === Kind.Account) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue