Migrate to stylistic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d8052e6a73
commit
6c6bf811a6
124 changed files with 239 additions and 196 deletions
|
@ -198,6 +198,8 @@ module.exports = {
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
// We're okay with assertion errors when we ask for them
|
// We're okay with assertion errors when we ask for them
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
// We do this sometimes to brand interfaces
|
||||||
|
"@typescript-eslint/no-empty-object-type": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// temporary override for offending icon require files
|
// temporary override for offending icon require files
|
||||||
|
|
|
@ -186,6 +186,7 @@
|
||||||
"@playwright/test": "^1.40.1",
|
"@playwright/test": "^1.40.1",
|
||||||
"@principalstudio/html-webpack-inject-preload": "^1.2.7",
|
"@principalstudio/html-webpack-inject-preload": "^1.2.7",
|
||||||
"@sentry/webpack-plugin": "^2.7.1",
|
"@sentry/webpack-plugin": "^2.7.1",
|
||||||
|
"@stylistic/eslint-plugin": "^2.9.0",
|
||||||
"@svgr/webpack": "^8.0.0",
|
"@svgr/webpack": "^8.0.0",
|
||||||
"@testing-library/dom": "^9.0.0",
|
"@testing-library/dom": "^9.0.0",
|
||||||
"@testing-library/jest-dom": "^6.0.0",
|
"@testing-library/jest-dom": "^6.0.0",
|
||||||
|
@ -246,7 +247,7 @@
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.25.4",
|
||||||
"eslint-plugin-jest": "^28.0.0",
|
"eslint-plugin-jest": "^28.0.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
"eslint-plugin-matrix-org": "1.2.1",
|
"eslint-plugin-matrix-org": "^2.0.2",
|
||||||
"eslint-plugin-react": "^7.28.0",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-unicorn": "^56.0.0",
|
"eslint-plugin-unicorn": "^56.0.0",
|
||||||
|
|
|
@ -69,7 +69,7 @@ export class MessageBuilder {
|
||||||
/**
|
/**
|
||||||
* Map of message content -> event.
|
* Map of message content -> event.
|
||||||
*/
|
*/
|
||||||
messages = new Map<String, Promise<JSHandle<MatrixEvent>>>();
|
messages = new Map<string, Promise<JSHandle<MatrixEvent>>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to find a MatrixEvent by its body content
|
* Utility to find a MatrixEvent by its body content
|
||||||
|
|
|
@ -70,7 +70,7 @@ export class MessageBuilder {
|
||||||
/**
|
/**
|
||||||
* Map of message content -> event.
|
* Map of message content -> event.
|
||||||
*/
|
*/
|
||||||
messages = new Map<String, Promise<JSHandle<MatrixEvent>>>();
|
messages = new Map<string, Promise<JSHandle<MatrixEvent>>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to find a MatrixEvent by its body content
|
* Utility to find a MatrixEvent by its body content
|
||||||
|
|
|
@ -35,6 +35,7 @@ export type Defaultize<P, D> = P extends any
|
||||||
Partial<Pick<D, Exclude<keyof D, keyof P>>>
|
Partial<Pick<D, Exclude<keyof D, keyof P>>>
|
||||||
: never;
|
: never;
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
||||||
export type DeepReadonly<T> = T extends (infer R)[]
|
export type DeepReadonly<T> = T extends (infer R)[]
|
||||||
? DeepReadonlyArray<R>
|
? DeepReadonlyArray<R>
|
||||||
: T extends Function
|
: T extends Function
|
||||||
|
@ -42,6 +43,7 @@ export type DeepReadonly<T> = T extends (infer R)[]
|
||||||
: T extends object
|
: T extends object
|
||||||
? DeepReadonlyObject<T>
|
? DeepReadonlyObject<T>
|
||||||
: T;
|
: T;
|
||||||
|
/* eslint-enable @typescript-eslint/no-unsafe-function-type */
|
||||||
|
|
||||||
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ export default abstract class BasePlatform {
|
||||||
try {
|
try {
|
||||||
const [version, deferUntil] = JSON.parse(localStorage.getItem(UPDATE_DEFER_KEY)!);
|
const [version, deferUntil] = JSON.parse(localStorage.getItem(UPDATE_DEFER_KEY)!);
|
||||||
return newVersion !== version || Date.now() > deferUntil;
|
return newVersion !== version || Date.now() > deferUntil;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ export default abstract class BasePlatform {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await idbSave("pickleKey", [userId, deviceId], data);
|
await idbSave("pickleKey", [userId, deviceId], data);
|
||||||
} catch (e) {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return encodeUnpaddedBase64(randomArray);
|
return encodeUnpaddedBase64(randomArray);
|
||||||
|
|
|
@ -48,7 +48,7 @@ function shouldCleanupDrafts(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return Date.now() > parsedTimestamp + DRAFT_CLEANUP_PERIOD;
|
return Date.now() > parsedTimestamp + DRAFT_CLEANUP_PERIOD;
|
||||||
} catch (error) {
|
} catch {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const EMOJI_REGEX = (() => {
|
||||||
// want the app to completely crash on older platforms. We use the
|
// want the app to completely crash on older platforms. We use the
|
||||||
// constructor here to avoid a syntax error on such platforms.
|
// constructor here to avoid a syntax error on such platforms.
|
||||||
return new RegExp("\\p{RGI_Emoji}(?!\\uFE0E)(?:(?<!\\uFE0F)\\uFE0F)?|[\\u{1f1e6}-\\u{1f1ff}]", "v");
|
return new RegExp("\\p{RGI_Emoji}(?!\\uFE0E)(?:(?<!\\uFE0F)\\uFE0F)?|[\\u{1f1e6}-\\u{1f1ff}]", "v");
|
||||||
} catch (_e) {
|
} catch {
|
||||||
// v mode not supported; fall back to matching nothing
|
// v mode not supported; fall back to matching nothing
|
||||||
return /(?!)/;
|
return /(?!)/;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ export const EMOJI_REGEX = (() => {
|
||||||
const BIGEMOJI_REGEX = (() => {
|
const BIGEMOJI_REGEX = (() => {
|
||||||
try {
|
try {
|
||||||
return new RegExp(`^(${EMOJI_REGEX.source})+$`, "iv");
|
return new RegExp(`^(${EMOJI_REGEX.source})+$`, "iv");
|
||||||
} catch (_e) {
|
} catch {
|
||||||
// Fall back, just like for EMOJI_REGEX
|
// Fall back, just like for EMOJI_REGEX
|
||||||
return /(?!)/;
|
return /(?!)/;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ export function isUrlPermitted(inputUrl: string): boolean {
|
||||||
try {
|
try {
|
||||||
// URL parser protocol includes the trailing colon
|
// URL parser protocol includes the trailing colon
|
||||||
return PERMITTED_URL_SCHEMES.includes(new URL(inputUrl).protocol.slice(0, -1));
|
return PERMITTED_URL_SCHEMES.includes(new URL(inputUrl).protocol.slice(0, -1));
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -827,7 +827,7 @@ export default class LegacyCallHandler extends EventEmitter {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.addCallForRoom(roomId, call);
|
this.addCallForRoom(roomId, call);
|
||||||
} catch (e) {
|
} catch {
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: _t("voip|already_in_call"),
|
title: _t("voip|already_in_call"),
|
||||||
description: _t("voip|already_in_call_person"),
|
description: _t("voip|already_in_call_person"),
|
||||||
|
|
|
@ -211,7 +211,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
||||||
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10);
|
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10);
|
||||||
const diff = Date.now() - registrationTime;
|
const diff = Date.now() - registrationTime;
|
||||||
return diff / 36e5 <= hours;
|
return diff / 36e5 <= hours;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
||||||
try {
|
try {
|
||||||
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10);
|
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10);
|
||||||
return timestamp.getTime() <= registrationTime;
|
return timestamp.getTime() <= registrationTime;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ export class PosthogAnalytics {
|
||||||
let appVersion: string | undefined;
|
let appVersion: string | undefined;
|
||||||
try {
|
try {
|
||||||
appVersion = await platform?.getAppVersion();
|
appVersion = await platform?.getAppVersion();
|
||||||
} catch (e) {
|
} catch {
|
||||||
// this happens if no version is set i.e. in dev
|
// this happens if no version is set i.e. in dev
|
||||||
appVersion = "unknown";
|
appVersion = "unknown";
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Presence {
|
||||||
try {
|
try {
|
||||||
await this.unavailableTimer.finished();
|
await this.unavailableTimer.finished();
|
||||||
this.setState(SetPresence.Unavailable);
|
this.setState(SetPresence.Unavailable);
|
||||||
} catch (e) {
|
} catch {
|
||||||
/* aborted, stop got called */
|
/* aborted, stop got called */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export function getRoomNotifsState(client: MatrixClient, roomId: string): RoomNo
|
||||||
let roomRule: IPushRule | undefined;
|
let roomRule: IPushRule | undefined;
|
||||||
try {
|
try {
|
||||||
roomRule = client.getRoomPushRule("global", roomId);
|
roomRule = client.getRoomPushRule("global", roomId);
|
||||||
} catch (err) {
|
} catch {
|
||||||
// Possible that the client doesn't have pushRules yet. If so, it
|
// Possible that the client doesn't have pushRules yet. If so, it
|
||||||
// hasn't started either, so indicate that this room is not notifying.
|
// hasn't started either, so indicate that this room is not notifying.
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -855,14 +855,14 @@ const onMessage = function (event: MessageEvent<any>): void {
|
||||||
try {
|
try {
|
||||||
if (!openManagerUrl) openManagerUrl = IntegrationManagers.sharedInstance().getPrimaryManager()?.uiUrl;
|
if (!openManagerUrl) openManagerUrl = IntegrationManagers.sharedInstance().getPrimaryManager()?.uiUrl;
|
||||||
configUrl = new URL(openManagerUrl!);
|
configUrl = new URL(openManagerUrl!);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// No integrations UI URL, ignore silently.
|
// No integrations UI URL, ignore silently.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let eventOriginUrl: URL;
|
let eventOriginUrl: URL;
|
||||||
try {
|
try {
|
||||||
eventOriginUrl = new URL(event.origin);
|
eventOriginUrl = new URL(event.origin);
|
||||||
} catch (e) {
|
} catch {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO -- Scalar postMessage API should be namespaced with event.data.api field
|
// TODO -- Scalar postMessage API should be namespaced with event.data.api field
|
||||||
|
|
|
@ -42,6 +42,7 @@ export const DEFAULTS: DeepReadonly<IConfigOptions> = {
|
||||||
// be preferred over their config.
|
// be preferred over their config.
|
||||||
desktopBuilds: {
|
desktopBuilds: {
|
||||||
available: true,
|
available: true,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
logo: require("../res/img/element-desktop-logo.svg").default,
|
logo: require("../res/img/element-desktop-logo.svg").default,
|
||||||
url: "https://element.io/get-started",
|
url: "https://element.io/get-started",
|
||||||
},
|
},
|
||||||
|
|
|
@ -252,7 +252,7 @@ export class SlidingSyncManager {
|
||||||
try {
|
try {
|
||||||
// wait until the next sync before returning as RoomView may need to know the current state
|
// wait until the next sync before returning as RoomView may need to know the current state
|
||||||
await p;
|
await p;
|
||||||
} catch (err) {
|
} catch {
|
||||||
logger.warn("SlidingSync setRoomVisible:", roomId, visible, "failed to confirm transaction");
|
logger.warn("SlidingSync setRoomVisible:", roomId, visible, "failed to confirm transaction");
|
||||||
}
|
}
|
||||||
return roomId;
|
return roomId;
|
||||||
|
@ -305,7 +305,7 @@ export class SlidingSyncManager {
|
||||||
} else {
|
} else {
|
||||||
await this.slidingSync!.setListRanges(SlidingSyncManager.ListSearch, ranges);
|
await this.slidingSync!.setListRanges(SlidingSyncManager.ListSearch, ranges);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
// do nothing, as we reject only when we get interrupted but that's fine as the next
|
// do nothing, as we reject only when we get interrupted but that's fine as the next
|
||||||
// request will include our data
|
// request will include our data
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -357,7 +357,7 @@ export class SlidingSyncManager {
|
||||||
}
|
}
|
||||||
const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain);
|
const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain);
|
||||||
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
|
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Either client.getDomain() is null so we've shorted out, or is invalid so `AutoDiscovery.findClientConfig` has thrown
|
// Either client.getDomain() is null so we've shorted out, or is invalid so `AutoDiscovery.findClientConfig` has thrown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ export default class UserActivity {
|
||||||
attachedTimers.forEach((t) => t.start());
|
attachedTimers.forEach((t) => t.start());
|
||||||
try {
|
try {
|
||||||
await timeout.finished();
|
await timeout.finished();
|
||||||
} catch (_e) {
|
} catch {
|
||||||
/* aborted */
|
/* aborted */
|
||||||
}
|
}
|
||||||
attachedTimers.forEach((t) => t.abort());
|
attachedTimers.forEach((t) => t.abort());
|
||||||
|
|
|
@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
import { _t } from "../../languageHandler";
|
import { _t } from "../../languageHandler";
|
||||||
|
import UploadBigSvg from "../../../res/img/upload-big.svg";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
parent: HTMLElement | null;
|
parent: HTMLElement | null;
|
||||||
|
@ -106,11 +107,7 @@ const FileDropTarget: React.FC<IProps> = ({ parent, onFileDrop }) => {
|
||||||
if (state.dragging) {
|
if (state.dragging) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_FileDropTarget">
|
<div className="mx_FileDropTarget">
|
||||||
<img
|
<img src={UploadBigSvg} className="mx_FileDropTarget_image" alt="" />
|
||||||
src={require("../../../res/img/upload-big.svg").default}
|
|
||||||
className="mx_FileDropTarget_image"
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
{_t("room|drop_file_prompt")}
|
{_t("room|drop_file_prompt")}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -161,9 +161,11 @@ export default class LegacyCallEventGrouper extends EventEmitter {
|
||||||
|
|
||||||
public toggleSilenced = (): void => {
|
public toggleSilenced = (): void => {
|
||||||
const silenced = LegacyCallHandler.instance.isCallSilenced(this.callId);
|
const silenced = LegacyCallHandler.instance.isCallSilenced(this.callId);
|
||||||
silenced
|
if (silenced) {
|
||||||
? LegacyCallHandler.instance.unSilenceCall(this.callId)
|
LegacyCallHandler.instance.unSilenceCall(this.callId);
|
||||||
: LegacyCallHandler.instance.silenceCall(this.callId);
|
} else {
|
||||||
|
LegacyCallHandler.instance.silenceCall(this.callId);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private setCallListeners(): void {
|
private setCallListeners(): void {
|
||||||
|
|
|
@ -982,7 +982,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
try {
|
try {
|
||||||
const config = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(params.hs_url);
|
const config = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(params.hs_url);
|
||||||
newState.serverConfig = config;
|
newState.serverConfig = config;
|
||||||
} catch (err) {
|
} catch {
|
||||||
logger.warn("Failed to load hs_url param:", params.hs_url);
|
logger.warn("Failed to load hs_url param:", params.hs_url);
|
||||||
}
|
}
|
||||||
} else if (params.client_secret && params.session_id && params.hs_url && params.is_url && params.sid) {
|
} else if (params.client_secret && params.session_id && params.hs_url && params.is_url && params.sid) {
|
||||||
|
|
|
@ -691,7 +691,7 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
|
||||||
|
|
||||||
hierarchy.removeRelation(parentId, childId);
|
hierarchy.removeRelation(parentId, childId);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
setError(_t("space|failed_remove_rooms"));
|
setError(_t("space|failed_remove_rooms"));
|
||||||
}
|
}
|
||||||
setRemoving(false);
|
setRemoving(false);
|
||||||
|
@ -724,7 +724,7 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
|
||||||
// mutate the local state to save us having to refetch the world
|
// mutate the local state to save us having to refetch the world
|
||||||
existingContent.suggested = content.suggested;
|
existingContent.suggested = content.suggested;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
setError("Failed to update some suggestions. Try again later");
|
setError("Failed to update some suggestions. Try again later");
|
||||||
}
|
}
|
||||||
setSaving(false);
|
setSaving(false);
|
||||||
|
|
|
@ -973,7 +973,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
||||||
UserActivity.sharedInstance().timeWhileActiveRecently(this.readMarkerActivityTimer);
|
UserActivity.sharedInstance().timeWhileActiveRecently(this.readMarkerActivityTimer);
|
||||||
try {
|
try {
|
||||||
await this.readMarkerActivityTimer.finished();
|
await this.readMarkerActivityTimer.finished();
|
||||||
} catch (e) {
|
} catch {
|
||||||
continue; /* aborted */
|
continue; /* aborted */
|
||||||
}
|
}
|
||||||
// outside of try/catch to not swallow errors
|
// outside of try/catch to not swallow errors
|
||||||
|
@ -988,7 +988,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
||||||
UserActivity.sharedInstance().timeWhileActiveNow(this.readReceiptActivityTimer);
|
UserActivity.sharedInstance().timeWhileActiveNow(this.readReceiptActivityTimer);
|
||||||
try {
|
try {
|
||||||
await this.readReceiptActivityTimer.finished();
|
await this.readReceiptActivityTimer.finished();
|
||||||
} catch (e) {
|
} catch {
|
||||||
continue; /* aborted */
|
continue; /* aborted */
|
||||||
}
|
}
|
||||||
// outside of try/catch to not swallow errors
|
// outside of try/catch to not swallow errors
|
||||||
|
|
|
@ -44,6 +44,7 @@ import { Icon as LiveIcon } from "../../../res/img/compound/live-8px.svg";
|
||||||
import { VoiceBroadcastRecording, VoiceBroadcastRecordingsStoreEvent } from "../../voice-broadcast";
|
import { VoiceBroadcastRecording, VoiceBroadcastRecordingsStoreEvent } from "../../voice-broadcast";
|
||||||
import { SDKContext } from "../../contexts/SDKContext";
|
import { SDKContext } from "../../contexts/SDKContext";
|
||||||
import { shouldShowFeedback } from "../../utils/Feedback";
|
import { shouldShowFeedback } from "../../utils/Feedback";
|
||||||
|
import DarkLightModeSvg from "../../../res/img/element-icons/roomlist/dark-light-mode.svg";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isPanelCollapsed: boolean;
|
isPanelCollapsed: boolean;
|
||||||
|
@ -414,12 +415,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
: _t("user_menu|switch_theme_dark")
|
: _t("user_menu|switch_theme_dark")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<img
|
<img src={DarkLightModeSvg} role="presentation" alt="" width={16} />
|
||||||
src={require("../../../res/img/element-icons/roomlist/dark-light-mode.svg").default}
|
|
||||||
role="presentation"
|
|
||||||
alt=""
|
|
||||||
width={16}
|
|
||||||
/>
|
|
||||||
</RovingAccessibleButton>
|
</RovingAccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
{topSection}
|
{topSection}
|
||||||
|
|
|
@ -274,7 +274,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
|
||||||
await this.reset.setNewPassword(this.state.password);
|
await this.reset.setNewPassword(this.state.password);
|
||||||
this.setState({ phase: Phase.Done });
|
this.setState({ phase: Phase.Done });
|
||||||
modal.close();
|
modal.close();
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Email not confirmed, yet. Retry after a while.
|
// Email not confirmed, yet. Retry after a while.
|
||||||
await sleep(emailCheckInterval);
|
await sleep(emailCheckInterval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// We're importing via require specifically so the svg becomes a URI rather than a DOM element.
|
// We're importing via require specifically so the svg becomes a URI rather than a DOM element.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const matrixSvg = require("../../../res/img/matrix.svg").default;
|
const matrixSvg = require("../../../res/img/matrix.svg").default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,7 @@ interface IProps extends Omit<ComponentProps<BaseAvatarType>, "name" | "url" | "
|
||||||
}
|
}
|
||||||
|
|
||||||
const WidgetAvatar: React.FC<IProps> = ({ app, className, size = "20px", ...props }) => {
|
const WidgetAvatar: React.FC<IProps> = ({ app, className, size = "20px", ...props }) => {
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
let iconUrls = [require("../../../../res/img/element-icons/room/default_app.svg").default];
|
let iconUrls = [require("../../../../res/img/element-icons/room/default_app.svg").default];
|
||||||
// heuristics for some better icons until Widgets support their own icons
|
// heuristics for some better icons until Widgets support their own icons
|
||||||
if (app.type.includes("jitsi")) {
|
if (app.type.includes("jitsi")) {
|
||||||
|
@ -31,6 +32,7 @@ const WidgetAvatar: React.FC<IProps> = ({ app, className, size = "20px", ...prop
|
||||||
} else if (app.type.includes("clock")) {
|
} else if (app.type.includes("clock")) {
|
||||||
iconUrls = [require("../../../../res/img/element-icons/room/default_clock.svg").default];
|
iconUrls = [require("../../../../res/img/element-icons/room/default_clock.svg").default];
|
||||||
}
|
}
|
||||||
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseAvatar
|
<BaseAvatar
|
||||||
|
|
|
@ -34,6 +34,7 @@ import LazyRenderList from "../elements/LazyRenderList";
|
||||||
import { useSettingValue } from "../../../hooks/useSettings";
|
import { useSettingValue } from "../../../hooks/useSettings";
|
||||||
import { filterBoolean } from "../../../utils/arrays";
|
import { filterBoolean } from "../../../utils/arrays";
|
||||||
import { NonEmptyArray } from "../../../@types/common";
|
import { NonEmptyArray } from "../../../@types/common";
|
||||||
|
import WarningBadgeSvg from "../../../../res/img/element-icons/warning-badge.svg";
|
||||||
|
|
||||||
// These values match CSS
|
// These values match CSS
|
||||||
const ROW_HEIGHT = 32 + 12;
|
const ROW_HEIGHT = 32 + 12;
|
||||||
|
@ -228,12 +229,7 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
||||||
if (error) {
|
if (error) {
|
||||||
footer = (
|
footer = (
|
||||||
<>
|
<>
|
||||||
<img
|
<img src={WarningBadgeSvg} height="24" width="24" alt="" />
|
||||||
src={require("../../../../res/img/element-icons/warning-badge.svg").default}
|
|
||||||
height="24"
|
|
||||||
width="24"
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
|
|
||||||
<span className="mx_AddExistingToSpaceDialog_error">
|
<span className="mx_AddExistingToSpaceDialog_error">
|
||||||
<div className="mx_AddExistingToSpaceDialog_errorHeading">
|
<div className="mx_AddExistingToSpaceDialog_errorHeading">
|
||||||
|
|
|
@ -23,6 +23,8 @@ import {
|
||||||
TimelineEvents,
|
TimelineEvents,
|
||||||
} from "matrix-js-sdk/src/matrix";
|
} from "matrix-js-sdk/src/matrix";
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
|
import OverflowHorizontalSvg from "@vector-im/compound-design-tokens/icons/overflow-horizontal.svg";
|
||||||
|
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import dis from "../../../dispatcher/dispatcher";
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
|
@ -104,7 +106,7 @@ const Entry: React.FC<IEntryProps<any>> = ({ room, type, content, matrixClient:
|
||||||
try {
|
try {
|
||||||
await cli.sendEvent(room.roomId, type, content);
|
await cli.sendEvent(room.roomId, type, content);
|
||||||
setSendState(SendState.Sent);
|
setSendState(SendState.Sent);
|
||||||
} catch (e) {
|
} catch {
|
||||||
setSendState(SendState.Failed);
|
setSendState(SendState.Failed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -278,13 +280,7 @@ const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCr
|
||||||
return (
|
return (
|
||||||
<EntityTile
|
<EntityTile
|
||||||
className="mx_EntityTile_ellipsis"
|
className="mx_EntityTile_ellipsis"
|
||||||
avatarJsx={
|
avatarJsx={<BaseAvatar url={OverflowHorizontalSvg} name="..." size="36px" />}
|
||||||
<BaseAvatar
|
|
||||||
url={require("@vector-im/compound-design-tokens/icons/overflow-horizontal.svg").default}
|
|
||||||
name="..."
|
|
||||||
size="36px"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
name={text}
|
name={text}
|
||||||
showPresence={false}
|
showPresence={false}
|
||||||
onClick={() => setTruncateAt(totalCount)}
|
onClick={() => setTruncateAt(totalCount)}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import { arrayFastClone } from "../../../utils/arrays";
|
||||||
import { ElementWidget } from "../../../stores/widgets/StopGapWidget";
|
import { ElementWidget } from "../../../stores/widgets/StopGapWidget";
|
||||||
import { ELEMENT_CLIENT_ID } from "../../../identifiers";
|
import { ELEMENT_CLIENT_ID } from "../../../identifiers";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import WarningBadgeSvg from "../../../../res/img/element-icons/warning-badge.svg";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
widgetDefinition: IModalWidgetOpenRequestData;
|
widgetDefinition: IModalWidgetOpenRequestData;
|
||||||
|
@ -185,12 +186,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
>
|
>
|
||||||
<div className="mx_ModalWidgetDialog_warning">
|
<div className="mx_ModalWidgetDialog_warning">
|
||||||
<img
|
<img src={WarningBadgeSvg} height="16" width="16" alt="" />
|
||||||
src={require("../../../../res/img/element-icons/warning-badge.svg").default}
|
|
||||||
height="16"
|
|
||||||
width="16"
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
{_t("widget|modal_data_warning", {
|
{_t("widget|modal_data_warning", {
|
||||||
widgetDomain: parsed.hostname,
|
widgetDomain: parsed.hostname,
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -21,11 +21,12 @@ import BaseDialog from "./BaseDialog";
|
||||||
import CopyableText from "../elements/CopyableText";
|
import CopyableText from "../elements/CopyableText";
|
||||||
import { XOR } from "../../../@types/common";
|
import { XOR } from "../../../@types/common";
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const socials = [
|
const socials = [
|
||||||
{
|
{
|
||||||
name: "Facebook",
|
name: "Facebook",
|
||||||
img: require("../../../../res/img/social/facebook.png"),
|
img: require("../../../../res/img/social/facebook.png"),
|
||||||
url: (url: String) => `https://www.facebook.com/sharer/sharer.php?u=${url}`,
|
url: (url: string) => `https://www.facebook.com/sharer/sharer.php?u=${url}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Twitter",
|
name: "Twitter",
|
||||||
|
@ -52,6 +53,7 @@ const socials = [
|
||||||
url: (url: string) => `mailto:?body=${url}`,
|
url: (url: string) => `mailto:?body=${url}`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
|
||||||
interface BaseProps {
|
interface BaseProps {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
||||||
recoveryKeyValid: true,
|
recoveryKeyValid: true,
|
||||||
recoveryKeyCorrect: correct,
|
recoveryKeyCorrect: correct,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch {
|
||||||
this.setState({
|
this.setState({
|
||||||
recoveryKeyValid: false,
|
recoveryKeyValid: false,
|
||||||
recoveryKeyCorrect: false,
|
recoveryKeyCorrect: false,
|
||||||
|
|
|
@ -127,7 +127,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent<IProps,
|
||||||
try {
|
try {
|
||||||
decodeRecoveryKey(recoveryKey);
|
decodeRecoveryKey(recoveryKey);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,10 @@ import { SetupEncryptionStore, Phase } from "../../../../stores/SetupEncryptionS
|
||||||
|
|
||||||
function iconFromPhase(phase?: Phase): string {
|
function iconFromPhase(phase?: Phase): string {
|
||||||
if (phase === Phase.Done) {
|
if (phase === Phase.Done) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
return require("../../../../../res/img/e2e/verified-deprecated.svg").default;
|
return require("../../../../../res/img/e2e/verified-deprecated.svg").default;
|
||||||
} else {
|
} else {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
return require("../../../../../res/img/e2e/warning-deprecated.svg").default;
|
return require("../../../../../res/img/e2e/warning-deprecated.svg").default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ Please see LICENSE files in the repository root for full details.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
import WarningSvg from "../../../../res/img/warning.svg";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
errorMsg?: string;
|
errorMsg?: string;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +18,7 @@ const AppWarning: React.FC<IProps> = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className="mx_AppWarning">
|
<div className="mx_AppWarning">
|
||||||
<div>
|
<div>
|
||||||
<img src={require("../../../../res/img/warning.svg").default} alt="" />
|
<img src={WarningSvg} alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>{props.errorMsg || "Error"}</span>
|
<span>{props.errorMsg || "Error"}</span>
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default class ReplyChain extends React.Component<IProps, IState> {
|
||||||
const inReplyToEventId = getParentEventId(ev);
|
const inReplyToEventId = getParentEventId(ev);
|
||||||
if (!inReplyToEventId) return null;
|
if (!inReplyToEventId) return null;
|
||||||
return await this.getEvent(inReplyToEventId);
|
return await this.getEvent(inReplyToEventId);
|
||||||
} catch (e) {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ export default class ReplyChain extends React.Component<IProps, IState> {
|
||||||
// ask the client to fetch the event we want using the context API, only interface to do so is to ask
|
// ask the client to fetch the event we want using the context API, only interface to do so is to ask
|
||||||
// for a timeline with that event, but once it is loaded we can use findEventById to look up the ev map
|
// for a timeline with that event, but once it is loaded we can use findEventById to look up the ev map
|
||||||
await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(), eventId);
|
await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(), eventId);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// if it fails catch the error and return early, there's no point trying to find the event in this case.
|
// if it fails catch the error and return early, there's no point trying to find the event in this case.
|
||||||
// Return null as it is falsy and thus should be treated as an error (as the event cannot be resolved).
|
// Return null as it is falsy and thus should be treated as an error (as the event cannot be resolved).
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -33,6 +33,7 @@ interface ISSOButtonProps extends IProps {
|
||||||
|
|
||||||
const getIcon = (brand: IdentityProviderBrand | string): string | null => {
|
const getIcon = (brand: IdentityProviderBrand | string): string | null => {
|
||||||
switch (brand) {
|
switch (brand) {
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
case IdentityProviderBrand.Apple:
|
case IdentityProviderBrand.Apple:
|
||||||
return require(`../../../../res/img/element-icons/brands/apple.svg`).default;
|
return require(`../../../../res/img/element-icons/brands/apple.svg`).default;
|
||||||
case IdentityProviderBrand.Facebook:
|
case IdentityProviderBrand.Facebook:
|
||||||
|
@ -47,6 +48,7 @@ const getIcon = (brand: IdentityProviderBrand | string): string | null => {
|
||||||
return require(`../../../../res/img/element-icons/brands/twitter.svg`).default;
|
return require(`../../../../res/img/element-icons/brands/twitter.svg`).default;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ const useMapWithStyle = ({
|
||||||
throw new Error("Invalid geo URI");
|
throw new Error("Invalid geo URI");
|
||||||
}
|
}
|
||||||
map.setCenter({ lon: coords.longitude, lat: coords.latitude });
|
map.setCenter({ lon: coords.longitude, lat: coords.latitude });
|
||||||
} catch (_error) {
|
} catch (e) {
|
||||||
logger.error("Could not set map center");
|
logger.error("Could not set map center", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [map, centerGeoUri]);
|
}, [map, centerGeoUri]);
|
||||||
|
@ -80,8 +80,8 @@ const useMapWithStyle = ({
|
||||||
[bounds.east, bounds.north],
|
[bounds.east, bounds.north],
|
||||||
);
|
);
|
||||||
map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 });
|
map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 });
|
||||||
} catch (_error) {
|
} catch (e) {
|
||||||
logger.error("Invalid map bounds");
|
logger.error("Invalid map bounds", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [map, bounds]);
|
}, [map, bounds]);
|
||||||
|
@ -170,7 +170,7 @@ const MapComponent: React.FC<MapProps> = ({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick && onClick();
|
onClick?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default class LegacyCallEvent extends React.PureComponent<IProps, IState>
|
||||||
this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(this.resizeObserverCallback);
|
this.resizeObserver = new ResizeObserver(this.resizeObserverCallback);
|
||||||
this.wrapperElement.current && this.resizeObserver.observe(this.wrapperElement.current);
|
if (this.wrapperElement.current) this.resizeObserver.observe(this.wrapperElement.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillUnmount(): void {
|
public componentWillUnmount(): void {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export let DOWNLOAD_ICON_URL: string; // cached copy of the download.svg asset f
|
||||||
|
|
||||||
async function cacheDownloadIcon(): Promise<void> {
|
async function cacheDownloadIcon(): Promise<void> {
|
||||||
if (DOWNLOAD_ICON_URL) return; // cached already
|
if (DOWNLOAD_ICON_URL) return; // cached already
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const svg = await fetch(require("@vector-im/compound-design-tokens/icons/download.svg").default).then((r) =>
|
const svg = await fetch(require("@vector-im/compound-design-tokens/icons/download.svg").default).then((r) =>
|
||||||
r.text(),
|
r.text(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { MediaEventContent } from "matrix-js-sdk/src/types";
|
||||||
|
|
||||||
import MImageBody from "./MImageBody";
|
import MImageBody from "./MImageBody";
|
||||||
import { BLURHASH_FIELD } from "../../../utils/image-media";
|
import { BLURHASH_FIELD } from "../../../utils/image-media";
|
||||||
|
import IconsShowStickersSvg from "../../../../res/img/icons-show-stickers.svg";
|
||||||
|
|
||||||
export default class MStickerBody extends MImageBody {
|
export default class MStickerBody extends MImageBody {
|
||||||
// Mostly empty to prevent default behaviour of MImageBody
|
// Mostly empty to prevent default behaviour of MImageBody
|
||||||
|
@ -44,7 +45,7 @@ export default class MStickerBody extends MImageBody {
|
||||||
aria-hidden
|
aria-hidden
|
||||||
alt=""
|
alt=""
|
||||||
className="mx_MStickerBody_placeholder"
|
className="mx_MStickerBody_placeholder"
|
||||||
src={require("../../../../res/img/icons-show-stickers.svg").default}
|
src={IconsShowStickersSvg}
|
||||||
width="80"
|
width="80"
|
||||||
height="80"
|
height="80"
|
||||||
onMouseEnter={this.onImageEnter}
|
onMouseEnter={this.onImageEnter}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePha
|
||||||
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
|
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
|
||||||
import ErrorDialog from "../dialogs/ErrorDialog";
|
import ErrorDialog from "../dialogs/ErrorDialog";
|
||||||
import { useMatrixClientContext } from "../../../contexts/MatrixClientContext";
|
import { useMatrixClientContext } from "../../../contexts/MatrixClientContext";
|
||||||
|
import WarningDeprecatedSvg from "../../../../res/img/e2e/warning-deprecated.svg";
|
||||||
|
import WarningSvg from "../../../../res/img/e2e/warning.svg";
|
||||||
|
|
||||||
// cancellation codes which constitute a key mismatch
|
// cancellation codes which constitute a key mismatch
|
||||||
const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
|
const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
|
||||||
|
@ -79,7 +81,7 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
|
||||||
) {
|
) {
|
||||||
isShowingMismatchModal.current = true;
|
isShowingMismatchModal.current = true;
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
headerImage: require("../../../../res/img/e2e/warning-deprecated.svg").default,
|
headerImage: WarningDeprecatedSvg,
|
||||||
title: _t("encryption|messages_not_secure|title"),
|
title: _t("encryption|messages_not_secure|title"),
|
||||||
description: (
|
description: (
|
||||||
<div>
|
<div>
|
||||||
|
@ -118,7 +120,7 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
|
||||||
setRequesting(false);
|
setRequesting(false);
|
||||||
|
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
headerImage: require("../../../../res/img/e2e/warning.svg").default,
|
headerImage: WarningSvg,
|
||||||
title: _t("encryption|verification|error_starting_title"),
|
title: _t("encryption|verification|error_starting_title"),
|
||||||
description: _t("encryption|verification|error_starting_description"),
|
description: _t("encryption|verification|error_starting_description"),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1356,7 +1356,7 @@ export const useDevices = (userId: string): IDevice[] | undefined | null => {
|
||||||
|
|
||||||
disambiguateDevices(devices);
|
disambiguateDevices(devices);
|
||||||
setDevices(devices);
|
setDevices(devices);
|
||||||
} catch (err) {
|
} catch {
|
||||||
setDevices(null);
|
setDevices(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||||
import { throttle } from "lodash";
|
import { throttle } from "lodash";
|
||||||
import { Button, Tooltip } from "@vector-im/compound-web";
|
import { Button, Tooltip } from "@vector-im/compound-web";
|
||||||
import UserAddIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-add-solid";
|
import UserAddIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-add-solid";
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
|
import OverflowHorizontalSvg from "@vector-im/compound-design-tokens/icons/overflow-horizontal.svg";
|
||||||
|
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import dis from "../../../dispatcher/dispatcher";
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
|
@ -237,13 +239,7 @@ export default class MemberList extends React.Component<IProps, IState> {
|
||||||
return (
|
return (
|
||||||
<EntityTile
|
<EntityTile
|
||||||
className="mx_EntityTile_ellipsis"
|
className="mx_EntityTile_ellipsis"
|
||||||
avatarJsx={
|
avatarJsx={<BaseAvatar url={OverflowHorizontalSvg} name="..." size="36px" />}
|
||||||
<BaseAvatar
|
|
||||||
url={require("@vector-im/compound-design-tokens/icons/overflow-horizontal.svg").default}
|
|
||||||
name="..."
|
|
||||||
size="36px"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
name={text}
|
name={text}
|
||||||
showPresence={false}
|
showPresence={false}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
|
|
@ -57,6 +57,7 @@ import { VoiceBroadcastInfoState } from "../../../voice-broadcast";
|
||||||
import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog";
|
import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog";
|
||||||
import { UIFeature } from "../../../settings/UIFeature";
|
import { UIFeature } from "../../../settings/UIFeature";
|
||||||
import { formatTimeLeft } from "../../../DateUtils";
|
import { formatTimeLeft } from "../../../DateUtils";
|
||||||
|
import RoomReplacedSvg from "../../../../res/img/room_replaced.svg";
|
||||||
|
|
||||||
// The prefix used when persisting editor drafts to localstorage.
|
// The prefix used when persisting editor drafts to localstorage.
|
||||||
export const WYSIWYG_EDITOR_STATE_STORAGE_PREFIX = "mx_wysiwyg_state_";
|
export const WYSIWYG_EDITOR_STATE_STORAGE_PREFIX = "mx_wysiwyg_state_";
|
||||||
|
@ -619,7 +620,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
|
||||||
aria-hidden
|
aria-hidden
|
||||||
alt=""
|
alt=""
|
||||||
className="mx_MessageComposer_roomReplaced_icon"
|
className="mx_MessageComposer_roomReplaced_icon"
|
||||||
src={require("../../../../res/img/room_replaced.svg").default}
|
src={RoomReplacedSvg}
|
||||||
/>
|
/>
|
||||||
<span className="mx_MessageComposer_roomReplaced_header">
|
<span className="mx_MessageComposer_roomReplaced_header">
|
||||||
{_t("composer|room_upgraded_notice")}
|
{_t("composer|room_upgraded_notice")}
|
||||||
|
|
|
@ -29,7 +29,7 @@ const RoomInfoLine: FC<IProps> = ({ room }) => {
|
||||||
if (room.getMyMembership() !== KnownMembership.Invite) return null;
|
if (room.getMyMembership() !== KnownMembership.Invite) return null;
|
||||||
try {
|
try {
|
||||||
return await room.client.getRoomSummary(room.roomId);
|
return await room.client.getRoomSummary(room.roomId);
|
||||||
} catch (e) {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, [room]);
|
}, [room]);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import ScalarAuthClient from "../../../ScalarAuthClient";
|
||||||
import GenericElementContextMenu from "../context_menus/GenericElementContextMenu";
|
import GenericElementContextMenu from "../context_menus/GenericElementContextMenu";
|
||||||
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
|
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
|
||||||
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
||||||
|
import StickerpackPlaceholderSvg from "../../../../res/img/stickerpack-placeholder.png";
|
||||||
|
|
||||||
// This should be below the dialog level (4000), but above the rest of the UI (1000-2000).
|
// This should be below the dialog level (4000), but above the rest of the UI (1000-2000).
|
||||||
// We sit in a context menu, so this should be given to the context menu.
|
// We sit in a context menu, so this should be given to the context menu.
|
||||||
|
@ -206,7 +207,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
||||||
<AccessibleButton onClick={this.launchManageIntegrations} className="mx_Stickers_contentPlaceholder">
|
<AccessibleButton onClick={this.launchManageIntegrations} className="mx_Stickers_contentPlaceholder">
|
||||||
<p>{_t("stickers|empty")}</p>
|
<p>{_t("stickers|empty")}</p>
|
||||||
<p className="mx_Stickers_addLink">{_t("stickers|empty_add_prompt")}</p>
|
<p className="mx_Stickers_addLink">{_t("stickers|empty_add_prompt")}</p>
|
||||||
<img src={require("../../../../res/img/stickerpack-placeholder.png")} alt="" />
|
<img src={StickerpackPlaceholderSvg} alt="" />
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ export const AddPrivilegedUsers: React.FC<AddPrivilegedUsersProps> = ({ room, de
|
||||||
await client.setPowerLevel(room.roomId, userIds, powerLevel);
|
await client.setPowerLevel(room.roomId, userIds, powerLevel);
|
||||||
setSelectedUsers([]);
|
setSelectedUsers([]);
|
||||||
setPowerLevel(defaultUserLevel);
|
setPowerLevel(defaultUserLevel);
|
||||||
} catch (error) {
|
} catch {
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: _t("common|error"),
|
title: _t("common|error"),
|
||||||
description: _t("error|update_power_level"),
|
description: _t("error|update_power_level"),
|
||||||
|
|
|
@ -52,7 +52,7 @@ async function checkIdentityServerUrl(u: string): Promise<string | null> {
|
||||||
} else {
|
} else {
|
||||||
return _t("identity_server|error_connection");
|
return _t("identity_server|error_connection");
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
return _t("identity_server|error_connection");
|
return _t("identity_server|error_connection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const UserPersonalInfoSettings: React.FC<UserPersonalInfoSettingsProps> =
|
||||||
setEmails(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Email));
|
setEmails(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Email));
|
||||||
setPhoneNumbers(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Phone));
|
setPhoneNumbers(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Phone));
|
||||||
setLoadingState("loaded");
|
setLoadingState("loaded");
|
||||||
} catch (e) {
|
} catch {
|
||||||
setLoadingState("error");
|
setLoadingState("error");
|
||||||
}
|
}
|
||||||
}, [client]);
|
}, [client]);
|
||||||
|
|
|
@ -156,7 +156,7 @@ const UserProfileSettings: React.FC<UserProfileSettingsProps> = ({
|
||||||
const { content_uri: uri } = await client.uploadContent(avatarFile);
|
const { content_uri: uri } = await client.uploadContent(avatarFile);
|
||||||
await client.setAvatarUrl(uri);
|
await client.setAvatarUrl(uri);
|
||||||
setAvatarURL(uri);
|
setAvatarURL(uri);
|
||||||
} catch (e) {
|
} catch {
|
||||||
setAvatarError(true);
|
setAvatarError(true);
|
||||||
} finally {
|
} finally {
|
||||||
removeToast();
|
removeToast();
|
||||||
|
|
|
@ -40,7 +40,7 @@ const DeviceNameEditor: React.FC<Props & { stopEditing: () => void }> = ({ devic
|
||||||
try {
|
try {
|
||||||
await saveDeviceName(deviceName);
|
await saveDeviceName(deviceName);
|
||||||
stopEditing();
|
stopEditing();
|
||||||
} catch (error) {
|
} catch {
|
||||||
setError(_t("settings|sessions|error_set_name"));
|
setError(_t("settings|sessions|error_set_name"));
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ export const DiscoverySettings: React.FC = () => {
|
||||||
);
|
);
|
||||||
logger.warn(e);
|
logger.warn(e);
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
})();
|
})();
|
||||||
}, [client, getThreepidState]);
|
}, [client, getThreepidState]);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
|
||||||
this.setState<any>({ [kind]: deviceId });
|
this.setState<any>({ [kind]: deviceId });
|
||||||
try {
|
try {
|
||||||
await MediaDeviceHandler.instance.setDevice(deviceId, kind);
|
await MediaDeviceHandler.instance.setDevice(deviceId, kind);
|
||||||
} catch (error) {
|
} catch {
|
||||||
logger.error(`Failed to set device ${kind}: ${deviceId}`);
|
logger.error(`Failed to set device ${kind}: ${deviceId}`);
|
||||||
// reset state to current value
|
// reset state to current value
|
||||||
this.setState<any>({ [kind]: mapDeviceKindToHandlerValue(kind) });
|
this.setState<any>({ [kind]: mapDeviceKindToHandlerValue(kind) });
|
||||||
|
|
|
@ -63,7 +63,7 @@ const QuickThemeSwitcher: React.FC<Props> = ({ requestClose }) => {
|
||||||
SettingsStore.setValue("use_system_theme", null, SettingLevel.DEVICE, false),
|
SettingsStore.setValue("use_system_theme", null, SettingLevel.DEVICE, false),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch {
|
||||||
dis.dispatch<RecheckThemePayload>({ action: Action.RecheckTheme });
|
dis.dispatch<RecheckThemePayload>({ action: Action.RecheckTheme });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ interface IItemProps extends InputHTMLAttributes<HTMLLIElement> {
|
||||||
activeSpaces: SpaceKey[];
|
activeSpaces: SpaceKey[];
|
||||||
isNested?: boolean;
|
isNested?: boolean;
|
||||||
isPanelCollapsed?: boolean;
|
isPanelCollapsed?: boolean;
|
||||||
onExpand?: Function;
|
onExpand?: () => void;
|
||||||
parents?: Set<string>;
|
parents?: Set<string>;
|
||||||
innerRef?: LegacyRef<HTMLLIElement>;
|
innerRef?: LegacyRef<HTMLLIElement>;
|
||||||
dragHandleProps?: DraggableProvidedDragHandleProps | null;
|
dragHandleProps?: DraggableProvidedDragHandleProps | null;
|
||||||
|
|
|
@ -34,6 +34,7 @@ export function UserOnboardingHeader({ useCase }: Props): JSX.Element {
|
||||||
let actionLabel: string;
|
let actionLabel: string;
|
||||||
|
|
||||||
switch (useCase) {
|
switch (useCase) {
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
case UseCase.PersonalMessaging:
|
case UseCase.PersonalMessaging:
|
||||||
title = _t("onboarding|personal_messaging_title");
|
title = _t("onboarding|personal_messaging_title");
|
||||||
image = require("../../../../res/img/user-onboarding/PersonalMessaging.png");
|
image = require("../../../../res/img/user-onboarding/PersonalMessaging.png");
|
||||||
|
@ -60,6 +61,7 @@ export function UserOnboardingHeader({ useCase }: Props): JSX.Element {
|
||||||
image = require("../../../../res/img/user-onboarding/PersonalMessaging.png");
|
image = require("../../../../res/img/user-onboarding/PersonalMessaging.png");
|
||||||
actionLabel = _t("onboarding|personal_messaging_action");
|
actionLabel = _t("onboarding|personal_messaging_action");
|
||||||
break;
|
break;
|
||||||
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function getDisplayAliasForAliasSet(canonicalAlias: string | null, altAliases: string[]): string | null {
|
function getDisplayAliasForAliasSet(canonicalAlias: string | null, altAliases: string[]): string | null {
|
||||||
// E.g. prefer one of the aliases over another
|
// E.g. prefer one of the aliases over another
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { UIComponent } from "../settings/UIFeature";
|
||||||
* @returns {boolean} True (default) if the user is able to see the component, false
|
* @returns {boolean} True (default) if the user is able to see the component, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function shouldShowComponent(component: UIComponent): boolean {
|
function shouldShowComponent(component: UIComponent): boolean {
|
||||||
return true; // default to visible
|
return true; // default to visible
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function requireCanonicalAliasAccessToPublish(): boolean {
|
function requireCanonicalAliasAccessToPublish(): boolean {
|
||||||
// Some environments may not care about this requirement and could return false
|
// Some environments may not care about this requirement and could return false
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function onLoggedOutAndStorageCleared(): void {
|
function onLoggedOutAndStorageCleared(): void {
|
||||||
// E.g. redirect user or call other APIs after logout
|
// E.g. redirect user or call other APIs after logout
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { Room } from "matrix-js-sdk/src/matrix";
|
||||||
* @param {Room} room The room to check the visibility of.
|
* @param {Room} room The room to check the visibility of.
|
||||||
* @returns {boolean} True if the room should be visible, false otherwise.
|
* @returns {boolean} True if the room should be visible, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function isRoomVisible(room: Room): boolean {
|
function isRoomVisible(room: Room): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { Capability, Widget } from "matrix-widget-api";
|
||||||
* @returns {Set<Capability>} Resolves to the capabilities that are approved for use
|
* @returns {Set<Capability>} Resolves to the capabilities that are approved for use
|
||||||
* by the widget. If none are approved, this should return an empty Set.
|
* by the widget. If none are approved, this should return an empty Set.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
async function preapproveCapabilities(
|
async function preapproveCapabilities(
|
||||||
widget: Widget,
|
widget: Widget,
|
||||||
requestedCapabilities: Set<Capability>,
|
requestedCapabilities: Set<Capability>,
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { ITemplateParams } from "matrix-widget-api";
|
||||||
* This will not be called until after isReady() resolves.
|
* This will not be called until after isReady() resolves.
|
||||||
* @returns {Partial<Omit<ITemplateParams, "widgetRoomId">>} The variables.
|
* @returns {Partial<Omit<ITemplateParams, "widgetRoomId">>} The variables.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function provideVariables(): Partial<Omit<ITemplateParams, "widgetRoomId">> {
|
function provideVariables(): Partial<Omit<ITemplateParams, "widgetRoomId">> {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -26,6 +27,7 @@ function provideVariables(): Partial<Omit<ITemplateParams, "widgetRoomId">> {
|
||||||
* to be provided. This will block widgets being rendered.
|
* to be provided. This will block widgets being rendered.
|
||||||
* @returns {Promise<boolean>} Resolves when ready.
|
* @returns {Promise<boolean>} Resolves when ready.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
async function isReady(): Promise<void> {
|
async function isReady(): Promise<void> {
|
||||||
return; // default no waiting
|
return; // default no waiting
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ const getValue = <T>(key: string, initialValue: T): T => {
|
||||||
try {
|
try {
|
||||||
const item = window.localStorage.getItem(key);
|
const item = window.localStorage.getItem(key);
|
||||||
return item ? JSON.parse(item) : initialValue;
|
return item ? JSON.parse(item) : initialValue;
|
||||||
} catch (error) {
|
} catch {
|
||||||
return initialValue;
|
return initialValue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -376,7 +376,7 @@ export function replaceByRegexes(text: string, mapping: IVariables | Tags): stri
|
||||||
let replaced: SubstitutionValue;
|
let replaced: SubstitutionValue;
|
||||||
// If substitution is a function, call it
|
// If substitution is a function, call it
|
||||||
if (mapping[regexpString] instanceof Function) {
|
if (mapping[regexpString] instanceof Function) {
|
||||||
replaced = ((mapping as Tags)[regexpString] as Function)(...capturedGroups);
|
replaced = ((mapping as Tags)[regexpString] as (...subs: string[]) => string)(...capturedGroups);
|
||||||
} else {
|
} else {
|
||||||
replaced = mapping[regexpString];
|
replaced = mapping[regexpString];
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ export const options: Opts = {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
// OK fine, it's not actually a permalink
|
// OK fine, it's not actually a permalink
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -215,7 +215,7 @@ export const options: Opts = {
|
||||||
} else {
|
} else {
|
||||||
return "_blank";
|
return "_blank";
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
// malformed URI
|
// malformed URI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class LocalRoom extends Room {
|
||||||
/** DM chat partner */
|
/** DM chat partner */
|
||||||
public targets: Member[] = [];
|
public targets: Member[] = [];
|
||||||
/** Callbacks that should be invoked after the actual room has been created. */
|
/** Callbacks that should be invoked after the actual room has been created. */
|
||||||
public afterCreateCallbacks: Function[] = [];
|
public afterCreateCallbacks: ((roomId: string) => void)[] = [];
|
||||||
public state: LocalRoomState = LocalRoomState.NEW;
|
public state: LocalRoomState = LocalRoomState.NEW;
|
||||||
|
|
||||||
public constructor(roomId: string, client: MatrixClient, myUserId: string) {
|
public constructor(roomId: string, client: MatrixClient, myUserId: string) {
|
||||||
|
|
|
@ -525,7 +525,7 @@ export function tryInitStorage(): Promise<void> {
|
||||||
let indexedDB;
|
let indexedDB;
|
||||||
try {
|
try {
|
||||||
indexedDB = window.indexedDB;
|
indexedDB = window.indexedDB;
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
|
|
||||||
if (indexedDB) {
|
if (indexedDB) {
|
||||||
global.mx_rage_store = new IndexedDBLogStore(indexedDB, global.mx_rage_logger);
|
global.mx_rage_store = new IndexedDBLogStore(indexedDB, global.mx_rage_logger);
|
||||||
|
|
|
@ -68,7 +68,7 @@ export async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promi
|
||||||
async function getAppVersion(): Promise<string | undefined> {
|
async function getAppVersion(): Promise<string | undefined> {
|
||||||
try {
|
try {
|
||||||
return await PlatformPeg.get()?.getAppVersion();
|
return await PlatformPeg.get()?.getAppVersion();
|
||||||
} catch (err) {
|
} catch {
|
||||||
// this happens if no version is set i.e. in dev
|
// this happens if no version is set i.e. in dev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ async function getAppVersion(): Promise<string | undefined> {
|
||||||
function matchesMediaQuery(query: string): string {
|
function matchesMediaQuery(query: string): string {
|
||||||
try {
|
try {
|
||||||
return String(window.matchMedia(query).matches);
|
return String(window.matchMedia(query).matches);
|
||||||
} catch (err) {
|
} catch {
|
||||||
// if not supported in browser
|
// if not supported in browser
|
||||||
}
|
}
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
|
@ -249,12 +249,12 @@ async function collectStorageStatInfo(body: FormData): Promise<void> {
|
||||||
if (navigator.storage && navigator.storage.persisted) {
|
if (navigator.storage && navigator.storage.persisted) {
|
||||||
try {
|
try {
|
||||||
body.append("storageManager_persisted", String(await navigator.storage.persisted()));
|
body.append("storageManager_persisted", String(await navigator.storage.persisted()));
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
} else if (document.hasStorageAccess) {
|
} else if (document.hasStorageAccess) {
|
||||||
// Safari
|
// Safari
|
||||||
try {
|
try {
|
||||||
body.append("storageManager_persisted", String(await document.hasStorageAccess()));
|
body.append("storageManager_persisted", String(await document.hasStorageAccess()));
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
if (navigator.storage && navigator.storage.estimate) {
|
if (navigator.storage && navigator.storage.estimate) {
|
||||||
try {
|
try {
|
||||||
|
@ -266,7 +266,7 @@ async function collectStorageStatInfo(body: FormData): Promise<void> {
|
||||||
body.append(`storageManager_usage_${k}`, String(estimate.usageDetails![k]));
|
body.append(`storageManager_usage_${k}`, String(estimate.usageDetails![k]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ export async function submitFeedback(
|
||||||
let version: string | undefined;
|
let version: string | undefined;
|
||||||
try {
|
try {
|
||||||
version = await PlatformPeg.get()?.getAppVersion();
|
version = await PlatformPeg.get()?.getAppVersion();
|
||||||
} catch (err) {} // PlatformPeg already logs this.
|
} catch {} // PlatformPeg already logs this.
|
||||||
|
|
||||||
const body = new FormData();
|
const body = new FormData();
|
||||||
if (label) body.append("label", label);
|
if (label) body.append("label", label);
|
||||||
|
|
|
@ -68,12 +68,12 @@ async function getStorageContext(): Promise<StorageContext> {
|
||||||
if (navigator.storage && navigator.storage.persisted) {
|
if (navigator.storage && navigator.storage.persisted) {
|
||||||
try {
|
try {
|
||||||
result["storageManager_persisted"] = String(await navigator.storage.persisted());
|
result["storageManager_persisted"] = String(await navigator.storage.persisted());
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
} else if (document.hasStorageAccess) {
|
} else if (document.hasStorageAccess) {
|
||||||
// Safari
|
// Safari
|
||||||
try {
|
try {
|
||||||
result["storageManager_persisted"] = String(await document.hasStorageAccess());
|
result["storageManager_persisted"] = String(await document.hasStorageAccess());
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
if (navigator.storage && navigator.storage.estimate) {
|
if (navigator.storage && navigator.storage.estimate) {
|
||||||
try {
|
try {
|
||||||
|
@ -87,7 +87,7 @@ async function getStorageContext(): Promise<StorageContext> {
|
||||||
});
|
});
|
||||||
result[`storageManager_usage`] = usageDetails.join(", ");
|
result[`storageManager_usage`] = usageDetails.join(", ");
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -227,6 +227,7 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
||||||
),
|
),
|
||||||
feedbackLabel: "video-room-feedback",
|
feedbackLabel: "video-room-feedback",
|
||||||
feedbackSubheading: _td("labs|video_rooms_feedbackSubheading"),
|
feedbackSubheading: _td("labs|video_rooms_feedbackSubheading"),
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
image: require("../../res/img/betas/video_rooms.png"),
|
image: require("../../res/img/betas/video_rooms.png"),
|
||||||
requiresRefresh: true,
|
requiresRefresh: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ export function isPushNotifyDisabled(): boolean {
|
||||||
|
|
||||||
function getNotifier(): any {
|
function getNotifier(): any {
|
||||||
// TODO: [TS] Formal type that doesn't cause a cyclical reference.
|
// TODO: [TS] Formal type that doesn't cause a cyclical reference.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
let Notifier = require("../../Notifier"); // avoids cyclical references
|
let Notifier = require("../../Notifier"); // avoids cyclical references
|
||||||
if (Notifier.default) Notifier = Notifier.default; // correct for webpack require() weirdness
|
if (Notifier.default) Notifier = Notifier.default; // correct for webpack require() weirdness
|
||||||
return Notifier;
|
return Notifier;
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default class LocalEchoWrapper extends SettingsHandler {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await handlerPromise;
|
await handlerPromise;
|
||||||
} catch (e) {
|
} catch {
|
||||||
// notify of a rollback
|
// notify of a rollback
|
||||||
this.handler.watchers?.notifyUpdate(settingName, roomId, this.level, currentValue);
|
this.handler.watchers?.notifyUpdate(settingName, roomId, this.level, currentValue);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -16,9 +16,7 @@ import { SettingLevel } from "../SettingLevel";
|
||||||
import { WatchManager } from "../WatchManager";
|
import { WatchManager } from "../WatchManager";
|
||||||
|
|
||||||
const DEFAULT_SETTINGS_EVENT_TYPE = "im.vector.web.settings";
|
const DEFAULT_SETTINGS_EVENT_TYPE = "im.vector.web.settings";
|
||||||
const PREVIEW_URLS_EVENT_TYPE = "org.matrix.room.preview_urls";
|
type RoomSettingsEventType = typeof DEFAULT_SETTINGS_EVENT_TYPE | "org.matrix.room.preview_urls";
|
||||||
|
|
||||||
type RoomSettingsEventType = typeof DEFAULT_SETTINGS_EVENT_TYPE | typeof PREVIEW_URLS_EVENT_TYPE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets and sets settings at the "room" level.
|
* Gets and sets settings at the "room" level.
|
||||||
|
|
|
@ -34,7 +34,7 @@ export const UPDATE_EVENT = "update";
|
||||||
* To update the state, use updateState() and preferably await the result to
|
* To update the state, use updateState() and preferably await the result to
|
||||||
* help prevent lock conflicts.
|
* help prevent lock conflicts.
|
||||||
*/
|
*/
|
||||||
export abstract class AsyncStore<T extends Object> extends EventEmitter {
|
export abstract class AsyncStore<T extends object> extends EventEmitter {
|
||||||
private storeState: Readonly<T>;
|
private storeState: Readonly<T>;
|
||||||
private lock = new AwaitLock();
|
private lock = new AwaitLock();
|
||||||
private readonly dispatcherRef: string;
|
private readonly dispatcherRef: string;
|
||||||
|
@ -72,7 +72,7 @@ export abstract class AsyncStore<T extends Object> extends EventEmitter {
|
||||||
* Updates the state of the store.
|
* Updates the state of the store.
|
||||||
* @param {T|*} newState The state to update in the store using Object.assign()
|
* @param {T|*} newState The state to update in the store using Object.assign()
|
||||||
*/
|
*/
|
||||||
protected async updateState(newState: T | Object): Promise<void> {
|
protected async updateState(newState: T | object): Promise<void> {
|
||||||
await this.lock.acquireAsync();
|
await this.lock.acquireAsync();
|
||||||
try {
|
try {
|
||||||
this.storeState = Object.freeze(Object.assign(<T>{}, this.storeState, newState));
|
this.storeState = Object.freeze(Object.assign(<T>{}, this.storeState, newState));
|
||||||
|
@ -87,7 +87,7 @@ export abstract class AsyncStore<T extends Object> extends EventEmitter {
|
||||||
* @param {T|*} newState The new state of the store.
|
* @param {T|*} newState The new state of the store.
|
||||||
* @param {boolean} quiet If true, the function will not raise an UPDATE_EVENT.
|
* @param {boolean} quiet If true, the function will not raise an UPDATE_EVENT.
|
||||||
*/
|
*/
|
||||||
protected async reset(newState: T | Object | null = null, quiet = false): Promise<void> {
|
protected async reset(newState: T | object | null = null, quiet = false): Promise<void> {
|
||||||
await this.lock.acquireAsync();
|
await this.lock.acquireAsync();
|
||||||
try {
|
try {
|
||||||
this.storeState = Object.freeze(<T>(newState || {}));
|
this.storeState = Object.freeze(<T>(newState || {}));
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { ActionPayload } from "../dispatcher/payloads";
|
||||||
import { ReadyWatchingStore } from "./ReadyWatchingStore";
|
import { ReadyWatchingStore } from "./ReadyWatchingStore";
|
||||||
import { MatrixDispatcher } from "../dispatcher/dispatcher";
|
import { MatrixDispatcher } from "../dispatcher/dispatcher";
|
||||||
|
|
||||||
export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<T> {
|
export abstract class AsyncStoreWithClient<T extends object> extends AsyncStore<T> {
|
||||||
protected readyStore: ReadyWatchingStore;
|
protected readyStore: ReadyWatchingStore;
|
||||||
|
|
||||||
protected constructor(dispatcher: MatrixDispatcher, initialState: T = <T>{}) {
|
protected constructor(dispatcher: MatrixDispatcher, initialState: T = <T>{}) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ export class MemberListStore {
|
||||||
// load using traditional lazy loading
|
// load using traditional lazy loading
|
||||||
try {
|
try {
|
||||||
await room.loadMembersIfNeeded();
|
await room.loadMembersIfNeeded();
|
||||||
} catch (ex) {
|
} catch {
|
||||||
/* already logged in RoomView */
|
/* already logged in RoomView */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,11 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
|
||||||
private onSilenceClick = (e: ButtonEvent): void => {
|
private onSilenceClick = (e: ButtonEvent): void => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const callId = this.props.call.callId;
|
const callId = this.props.call.callId;
|
||||||
this.state.silenced
|
if (this.state.silenced) {
|
||||||
? LegacyCallHandler.instance.unSilenceCall(callId)
|
LegacyCallHandler.instance.unSilenceCall(callId);
|
||||||
: LegacyCallHandler.instance.silenceCall(callId);
|
} else {
|
||||||
|
LegacyCallHandler.instance.silenceCall(callId);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
|
|
|
@ -223,7 +223,7 @@ export async function fetchInitialEvent(
|
||||||
try {
|
try {
|
||||||
const eventData = await client.fetchRoomEvent(roomId, eventId);
|
const eventData = await client.fetchRoomEvent(roomId, eventId);
|
||||||
initialEvent = new MatrixEvent(eventData);
|
initialEvent = new MatrixEvent(eventData);
|
||||||
} catch (e) {
|
} catch {
|
||||||
logger.warn("Could not find initial event: " + eventId);
|
logger.warn("Could not find initial event: " + eventId);
|
||||||
initialEvent = null;
|
initialEvent = null;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ export async function fetchInitialEvent(
|
||||||
const rootEvent = room?.findEventById(threadId) ?? mapper(await client.fetchRoomEvent(roomId, threadId));
|
const rootEvent = room?.findEventById(threadId) ?? mapper(await client.fetchRoomEvent(roomId, threadId));
|
||||||
try {
|
try {
|
||||||
room?.createThread(threadId, rootEvent, [initialEvent], true);
|
room?.createThread(threadId, rootEvent, [initialEvent], true);
|
||||||
} catch (e) {
|
} catch {
|
||||||
logger.warn("Could not find root event: " + threadId);
|
logger.warn("Could not find root event: " + threadId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ export async function fixupColorFonts(): Promise<void> {
|
||||||
colrFontCheckStarted = true;
|
colrFontCheckStarted = true;
|
||||||
|
|
||||||
if (await isColrFontSupported()) {
|
if (await isColrFontSupported()) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2")}')`;
|
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2")}')`;
|
||||||
document.fonts.add(new FontFace("Twemoji", path, {}));
|
document.fonts.add(new FontFace("Twemoji", path, {}));
|
||||||
// For at least Chrome on Windows 10, we have to explictly add extra
|
// For at least Chrome on Windows 10, we have to explictly add extra
|
||||||
|
@ -113,6 +114,7 @@ export async function fixupColorFonts(): Promise<void> {
|
||||||
document.fonts.add(new FontFace("Twemoji", path, { weight: "700" }));
|
document.fonts.add(new FontFace("Twemoji", path, { weight: "700" }));
|
||||||
} else {
|
} else {
|
||||||
// fall back to SBIX, generated via https://github.com/matrix-org/twemoji-colr/tree/matthew/sbix
|
// fall back to SBIX, generated via https://github.com/matrix-org/twemoji-colr/tree/matthew/sbix
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.woff2")}')`;
|
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.woff2")}')`;
|
||||||
document.fonts.add(new FontFace("Twemoji", path, {}));
|
document.fonts.add(new FontFace("Twemoji", path, {}));
|
||||||
document.fonts.add(new FontFace("Twemoji", path, { weight: "600" }));
|
document.fonts.add(new FontFace("Twemoji", path, { weight: "600" }));
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { EnhancedMap } from "./maps";
|
||||||
|
|
||||||
// Inspired by https://pkg.go.dev/golang.org/x/sync/singleflight
|
// Inspired by https://pkg.go.dev/golang.org/x/sync/singleflight
|
||||||
|
|
||||||
const keyMap = new EnhancedMap<Object, EnhancedMap<string, unknown>>();
|
const keyMap = new EnhancedMap<object, EnhancedMap<string, unknown>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access class to get a singleflight context. Singleflights execute a
|
* Access class to get a singleflight context. Singleflights execute a
|
||||||
|
@ -47,7 +47,7 @@ export class Singleflight {
|
||||||
* @param {string} key A string key relevant to that instance to namespace under.
|
* @param {string} key A string key relevant to that instance to namespace under.
|
||||||
* @returns {SingleflightContext} Returns the context to execute the function.
|
* @returns {SingleflightContext} Returns the context to execute the function.
|
||||||
*/
|
*/
|
||||||
public static for(instance?: Object | null, key?: string | null): SingleflightContext {
|
public static for(instance?: object | null, key?: string | null): SingleflightContext {
|
||||||
if (!instance || !key) throw new Error("An instance and key must be supplied");
|
if (!instance || !key) throw new Error("An instance and key must be supplied");
|
||||||
return new SingleflightContext(instance, key);
|
return new SingleflightContext(instance, key);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export class Singleflight {
|
||||||
* Forgets all results for a given instance.
|
* Forgets all results for a given instance.
|
||||||
* @param {Object} instance The instance to forget about.
|
* @param {Object} instance The instance to forget about.
|
||||||
*/
|
*/
|
||||||
public static forgetAllFor(instance: Object): void {
|
public static forgetAllFor(instance: object): void {
|
||||||
keyMap.delete(instance);
|
keyMap.delete(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ export class Singleflight {
|
||||||
|
|
||||||
class SingleflightContext {
|
class SingleflightContext {
|
||||||
public constructor(
|
public constructor(
|
||||||
private instance: Object,
|
private instance: object,
|
||||||
private key: string,
|
private key: string,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ export function getIDBFactory(): IDBFactory | undefined {
|
||||||
// We check `self` first because `window` returns something which doesn't work for service workers.
|
// We check `self` first because `window` returns something which doesn't work for service workers.
|
||||||
// Note: `self?.indexedDB ?? window.indexedDB` breaks in service workers for unknown reasons.
|
// Note: `self?.indexedDB ?? window.indexedDB` breaks in service workers for unknown reasons.
|
||||||
return self?.indexedDB ? self.indexedDB : window.indexedDB;
|
return self?.indexedDB ? self.indexedDB : window.indexedDB;
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let idb: IDBDatabase | null = null;
|
let idb: IDBDatabase | null = null;
|
||||||
|
|
|
@ -251,7 +251,7 @@ export default class WidgetUtils {
|
||||||
// Delete existing widget with ID
|
// Delete existing widget with ID
|
||||||
try {
|
try {
|
||||||
delete userWidgets[widgetId];
|
delete userWidgets[widgetId];
|
||||||
} catch (e) {
|
} catch {
|
||||||
logger.error(`$widgetId is non-configurable`);
|
logger.error(`$widgetId is non-configurable`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const useOwnLiveBeacons = (liveBeaconIds: BeaconIdentifier[]): LiveBeacon
|
||||||
setStoppingInProgress(true);
|
setStoppingInProgress(true);
|
||||||
try {
|
try {
|
||||||
await Promise.all(liveBeaconIds.map((beaconId) => OwnBeaconStore.instance.stopBeacon(beaconId)));
|
await Promise.all(liveBeaconIds.map((beaconId) => OwnBeaconStore.instance.stopBeacon(beaconId)));
|
||||||
} catch (error) {
|
} catch {
|
||||||
setStoppingInProgress(false);
|
setStoppingInProgress(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ const localStorage = window.localStorage;
|
||||||
let indexedDB: IDBFactory;
|
let indexedDB: IDBFactory;
|
||||||
try {
|
try {
|
||||||
indexedDB = window.indexedDB;
|
indexedDB = window.indexedDB;
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new matrix client, with the persistent stores set up appropriately
|
* Create a new matrix client, with the persistent stores set up appropriately
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const isBulkUnverifiedDeviceReminderSnoozed = (): boolean => {
|
||||||
const parsedTimestamp = Number.parseInt(snoozedTimestamp || "", 10);
|
const parsedTimestamp = Number.parseInt(snoozedTimestamp || "", 10);
|
||||||
|
|
||||||
return Number.isInteger(parsedTimestamp) && parsedTimestamp + snoozePeriod > Date.now();
|
return Number.isInteger(parsedTimestamp) && parsedTimestamp + snoozePeriod > Date.now();
|
||||||
} catch (error) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -229,7 +229,7 @@ export default abstract class Exporter {
|
||||||
const image = await fetch(media.srcHttp);
|
const image = await fetch(media.srcHttp);
|
||||||
blob = await image.blob();
|
blob = await image.blob();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
logger.log("Error decrypting media");
|
logger.log("Error decrypting media");
|
||||||
}
|
}
|
||||||
if (!blob) {
|
if (!blob) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ export async function createThumbnail(
|
||||||
try {
|
try {
|
||||||
canvas = new window.OffscreenCanvas(targetWidth, targetHeight);
|
canvas = new window.OffscreenCanvas(targetWidth, targetHeight);
|
||||||
context = canvas.getContext("2d") as OffscreenCanvasRenderingContext2D;
|
context = canvas.getContext("2d") as OffscreenCanvasRenderingContext2D;
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Fallback support for other browsers (Safari and Firefox for now)
|
// Fallback support for other browsers (Safari and Firefox for now)
|
||||||
canvas = document.createElement("canvas");
|
canvas = document.createElement("canvas");
|
||||||
canvas.width = targetWidth;
|
canvas.width = targetWidth;
|
||||||
|
|
|
@ -377,7 +377,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
||||||
if (m) {
|
if (m) {
|
||||||
return m[1];
|
return m[1];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Not a valid URI
|
// Not a valid URI
|
||||||
return permalink;
|
return permalink;
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
||||||
permalink = `#/user/${permalinkParts.userId}`;
|
permalink = `#/user/${permalinkParts.userId}`;
|
||||||
} // else not a valid permalink for our purposes - do not handle
|
} // else not a valid permalink for our purposes - do not handle
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Not an href we need to care about
|
// Not an href we need to care about
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ export function getPrimaryPermalinkEntity(permalink: string): string | null {
|
||||||
if (!permalinkParts) return null; // not processable
|
if (!permalinkParts) return null; // not processable
|
||||||
if (permalinkParts.userId) return permalinkParts.userId;
|
if (permalinkParts.userId) return permalinkParts.userId;
|
||||||
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
|
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
|
||||||
} catch (e) {
|
} catch {
|
||||||
// no entity - not a permalink
|
// no entity - not a permalink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ export async function buildAndEncodePickleKey(
|
||||||
if (pickleKeyBuf) {
|
if (pickleKeyBuf) {
|
||||||
return encodeUnpaddedBase64(pickleKeyBuf);
|
return encodeUnpaddedBase64(pickleKeyBuf);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
logger.error("Error decrypting pickle key");
|
logger.error("Error decrypting pickle key");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ export async function persistTokenInStorage(
|
||||||
// token if there is no token or we were unable to encrypt (e.g. if the browser doesn't
|
// token if there is no token or we were unable to encrypt (e.g. if the browser doesn't
|
||||||
// have WebCrypto).
|
// have WebCrypto).
|
||||||
await StorageAccess.idbSave("account", storageKey, encryptedToken || token);
|
await StorageAccess.idbSave("account", storageKey, encryptedToken || token);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// if we couldn't save to indexedDB, fall back to localStorage. We
|
// if we couldn't save to indexedDB, fall back to localStorage. We
|
||||||
// store the access token unencrypted since localStorage only saves
|
// store the access token unencrypted since localStorage only saves
|
||||||
// strings.
|
// strings.
|
||||||
|
@ -163,7 +163,7 @@ export async function persistTokenInStorage(
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
await StorageAccess.idbSave("account", storageKey, token);
|
await StorageAccess.idbSave("account", storageKey, token);
|
||||||
} catch (e) {
|
} catch {
|
||||||
if (!!token) {
|
if (!!token) {
|
||||||
localStorage.setItem(storageKey, token);
|
localStorage.setItem(storageKey, token);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,7 @@ export function tooltipifyLinks(rootNodes: ArrayLike<Element>, ignoredNodes: Ele
|
||||||
let href = node.getAttribute("href")!;
|
let href = node.getAttribute("href")!;
|
||||||
try {
|
try {
|
||||||
href = new URL(href, window.location.href).toString();
|
href = new URL(href, window.location.href).toString();
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Not all hrefs will be valid URLs
|
// Not all hrefs will be valid URLs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export async function getVectorConfig(relativeLocation = ""): Promise<IConfigOpt
|
||||||
throw new Error(); // throw to enter the catch
|
throw new Error(); // throw to enter the catch
|
||||||
}
|
}
|
||||||
return configJson;
|
return configJson;
|
||||||
} catch (e) {
|
} catch {
|
||||||
return generalConfigPromise;
|
return generalConfigPromise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,10 @@ import "./modernizr";
|
||||||
// Require common CSS here; this will make webpack process it into bundle.css.
|
// Require common CSS here; this will make webpack process it into bundle.css.
|
||||||
// Our own CSS (which is themed) is imported via separate webpack entry points
|
// Our own CSS (which is themed) is imported via separate webpack entry points
|
||||||
// in webpack.config.js
|
// in webpack.config.js
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
require("katex/dist/katex.css");
|
require("katex/dist/katex.css");
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
require("./localstorage-fix");
|
require("./localstorage-fix");
|
||||||
|
|
||||||
async function settled(...promises: Array<Promise<any>>): Promise<void> {
|
async function settled(...promises: Array<Promise<any>>): Promise<void> {
|
||||||
|
|
|
@ -62,6 +62,7 @@ interface ExternalAPIOptions extends _ExternalAPIOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to trick webpack into loading our CSS for us.
|
// We have to trick webpack into loading our CSS for us.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
require("./index.pcss");
|
require("./index.pcss");
|
||||||
|
|
||||||
const JITSI_OPENIDTOKEN_JWT_AUTH = "openidtoken-jwt";
|
const JITSI_OPENIDTOKEN_JWT_AUTH = "openidtoken-jwt";
|
||||||
|
|
|
@ -265,7 +265,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
|
|
||||||
const notification = super.displayNotification(title, msg, avatarUrl, room, ev);
|
const notification = super.displayNotification(title, msg, avatarUrl, room, ev);
|
||||||
|
|
||||||
const handler = notification.onclick as Function;
|
const handler = notification.onclick as () => void;
|
||||||
notification.onclick = (): void => {
|
notification.onclick = (): void => {
|
||||||
handler?.();
|
handler?.();
|
||||||
void this.ipc.call("focusWindow");
|
void this.ipc.call("focusWindow");
|
||||||
|
@ -416,7 +416,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
public async getPickleKey(userId: string, deviceId: string): Promise<string | null> {
|
public async getPickleKey(userId: string, deviceId: string): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
return await this.ipc.call("getPickleKey", userId, deviceId);
|
return await this.ipc.call("getPickleKey", userId, deviceId);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// if we can't connect to the password storage, assume there's no
|
// if we can't connect to the password storage, assume there's no
|
||||||
// pickle key
|
// pickle key
|
||||||
return null;
|
return null;
|
||||||
|
@ -426,7 +426,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
public async createPickleKey(userId: string, deviceId: string): Promise<string | null> {
|
public async createPickleKey(userId: string, deviceId: string): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
return await this.ipc.call("createPickleKey", userId, deviceId);
|
return await this.ipc.call("createPickleKey", userId, deviceId);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// if we can't connect to the password storage, assume there's no
|
// if we can't connect to the password storage, assume there's no
|
||||||
// pickle key
|
// pickle key
|
||||||
return null;
|
return null;
|
||||||
|
@ -436,14 +436,14 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
public async destroyPickleKey(userId: string, deviceId: string): Promise<void> {
|
public async destroyPickleKey(userId: string, deviceId: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await this.ipc.call("destroyPickleKey", userId, deviceId);
|
await this.ipc.call("destroyPickleKey", userId, deviceId);
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async clearStorage(): Promise<void> {
|
public async clearStorage(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await super.clearStorage();
|
await super.clearStorage();
|
||||||
await this.ipc.call("clearStorage");
|
await this.ipc.call("clearStorage");
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get baseUrl(): string {
|
public get baseUrl(): string {
|
||||||
|
|
|
@ -76,7 +76,7 @@ export class VoiceBroadcastRecorder
|
||||||
public async stop(): Promise<Optional<ChunkRecordedPayload>> {
|
public async stop(): Promise<Optional<ChunkRecordedPayload>> {
|
||||||
try {
|
try {
|
||||||
await this.voiceRecording.stop();
|
await this.voiceRecording.stop();
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Ignore if the recording raises any error.
|
// Ignore if the recording raises any error.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ export const retrieveStartedInfoEvent = async (
|
||||||
try {
|
try {
|
||||||
const relatedEventData = await client.fetchRoomEvent(roomId, relatedEventId);
|
const relatedEventData = await client.fetchRoomEvent(roomId, relatedEventId);
|
||||||
return new MatrixEvent(relatedEventData);
|
return new MatrixEvent(relatedEventData);
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class Jitsi {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`https://${this.preferredDomain}/.well-known/element/jitsi`);
|
const response = await fetch(`https://${this.preferredDomain}/.well-known/element/jitsi`);
|
||||||
data = await response.json();
|
data = await response.json();
|
||||||
} catch (error) {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (data.auth) {
|
if (data.auth) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ beforeEach(() => {
|
||||||
//
|
//
|
||||||
// These are also require() calls to make sure they get called
|
// These are also require() calls to make sure they get called
|
||||||
// synchronously.
|
// synchronously.
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
require("./setup/setupManualMocks"); // must be first
|
require("./setup/setupManualMocks"); // must be first
|
||||||
require("./setup/setupLanguage");
|
require("./setup/setupLanguage");
|
||||||
require("./setup/setupConfig");
|
require("./setup/setupConfig");
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue