Conform more of the codebase to strictNullChecks & noImplicitAny (#25680)

This commit is contained in:
Michael Telatynski 2023-06-28 15:09:36 +01:00 committed by GitHub
parent 6bbc2b8238
commit 0299aef79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 8 deletions

View file

@ -37,9 +37,40 @@ import type {
AudioMuteStatusChangedEvent, AudioMuteStatusChangedEvent,
LogEvent, LogEvent,
VideoMuteStatusChangedEvent, VideoMuteStatusChangedEvent,
ExternalAPIOptions as _ExternalAPIOptions,
Config as _Config,
InterfaceConfig as _InterfaceConfig,
} from "jitsi-meet"; } from "jitsi-meet";
import { getVectorConfig } from "../getconfig"; import { getVectorConfig } from "../getconfig";
interface Config extends _Config {
// Jitsi's types are missing these fields
prejoinConfig?: {
enabled: boolean;
hideDisplayName?: boolean;
hideExtraJoinButtons?: string[];
};
toolbarButtons?: string[];
conferenceInfo?: {
alwaysVIsible?: string[];
autoHide?: string[];
};
disableSelfViewSettings?: boolean;
}
interface InterfaceConfig extends _InterfaceConfig {
// XXX: It is unclear whether this is a typo of TOOLBAR_BUTTONS or if its just really undocumented,
// either way it is missing in types, yet we try and use it
MAIN_TOOLBAR_BUTTONS?: string[];
}
interface ExternalAPIOptions extends _ExternalAPIOptions {
configOverwrite?: Config;
interfaceConfigOverwrite?: InterfaceConfig;
// Jitsi's types are missing these fields
lang?: string;
}
// We have to trick webpack into loading our CSS for us. // We have to trick webpack into loading our CSS for us.
require("./index.pcss"); require("./index.pcss");
@ -382,7 +413,7 @@ async function joinConference(audioInput?: string | null, videoInput?: string |
"our fragment values and not recognizing the options.", "our fragment values and not recognizing the options.",
); );
const options = { const options: ExternalAPIOptions = {
width: "100%", width: "100%",
height: "100%", height: "100%",
parentNode: document.querySelector("#jitsiContainer") ?? undefined, parentNode: document.querySelector("#jitsiContainer") ?? undefined,
@ -421,20 +452,20 @@ async function joinConference(audioInput?: string | null, videoInput?: string |
if (isVideoChannel) { if (isVideoChannel) {
// Ensure that we skip Jitsi Meet's native prejoin screen, for // Ensure that we skip Jitsi Meet's native prejoin screen, for
// deployments that have it enabled // deployments that have it enabled
options.configOverwrite.prejoinConfig = { enabled: false }; options.configOverwrite!.prejoinConfig = { enabled: false };
// Use a simplified set of toolbar buttons // Use a simplified set of toolbar buttons
options.configOverwrite.toolbarButtons = ["microphone", "camera", "tileview", "hangup"]; options.configOverwrite!.toolbarButtons = ["microphone", "camera", "tileview", "hangup"];
// Note: We can hide the screenshare button in video rooms but not in // Note: We can hide the screenshare button in video rooms but not in
// normal conference calls, since in video rooms we control exactly what // normal conference calls, since in video rooms we control exactly what
// set of controls appear, but in normal calls we need to leave that up // set of controls appear, but in normal calls we need to leave that up
// to the deployment's configuration. // to the deployment's configuration.
// https://github.com/vector-im/element-web/issues/4880#issuecomment-940002464 // https://github.com/vector-im/element-web/issues/4880#issuecomment-940002464
if (supportsScreensharing) options.configOverwrite.toolbarButtons.splice(2, 0, "desktop"); if (supportsScreensharing) options.configOverwrite!.toolbarButtons.splice(2, 0, "desktop");
// Hide all top bar elements // Hide all top bar elements
options.configOverwrite.conferenceInfo = { autoHide: [] }; options.configOverwrite!.conferenceInfo = { autoHide: [] };
// Remove the ability to hide your own tile, since we're hiding the // Remove the ability to hide your own tile, since we're hiding the
// settings button which would be the only way to get it back // settings button which would be the only way to get it back
options.configOverwrite.disableSelfViewSettings = true; options.configOverwrite!.disableSelfViewSettings = true;
} }
meetApi = new JitsiMeetExternalAPI(jitsiDomain, options); meetApi = new JitsiMeetExternalAPI(jitsiDomain, options);

View file

@ -460,8 +460,8 @@ describe("loading:", function () {
httpBackend.verifyNoOutstandingExpectation(); httpBackend.verifyNoOutstandingExpectation();
expect(matrixChat?.container.querySelector(".mx_Welcome")).toBeTruthy(); expect(matrixChat?.container.querySelector(".mx_Welcome")).toBeTruthy();
expect(windowLocation?.hash).toEqual("#/welcome"); expect(windowLocation?.hash).toEqual("#/welcome");
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL); expect(MatrixClientPeg.safeGet().baseUrl).toEqual(DEFAULT_HS_URL);
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL); expect(MatrixClientPeg.safeGet().idBaseUrl).toEqual(DEFAULT_IS_URL);
}); });
}); });