diff --git a/.eslintrc.js b/.eslintrc.js index 8cc5890ca46..30e01f86b5d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -102,7 +102,6 @@ module.exports = { rules: { // temporary disabled "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-member-accessibility": "off", // Things we do that break the ideal style "prefer-promise-reject-errors": "off", @@ -157,6 +156,14 @@ module.exports = { "@typescript-eslint/no-var-requires": "off", }, }, + { + files: ["test/**/*.{ts,tsx}", "cypress/**/*.ts"], + rules: { + // We don't need super strict typing in test utilities + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + }, + }, ], settings: { react: { diff --git a/src/@types/polyfill.ts b/src/@types/polyfill.ts index 12a201e9c8e..d24d2f4463e 100644 --- a/src/@types/polyfill.ts +++ b/src/@types/polyfill.ts @@ -48,7 +48,7 @@ export function polyfillTouchEvent() { public get scale(): number { return 0.0; } - constructor(eventType: string, params?: any) { + public constructor(eventType: string, params?: any) { super(eventType, params); } }; diff --git a/src/@types/worker-loader.d.ts b/src/@types/worker-loader.d.ts index a8f5d8e9a47..9eecd59055f 100644 --- a/src/@types/worker-loader.d.ts +++ b/src/@types/worker-loader.d.ts @@ -16,7 +16,7 @@ limitations under the License. declare module "*.worker.ts" { class WebpackWorker extends Worker { - constructor(); + public constructor(); } export default WebpackWorker; diff --git a/src/AddThreepid.ts b/src/AddThreepid.ts index eb06169c090..b6ed0d57387 100644 --- a/src/AddThreepid.ts +++ b/src/AddThreepid.ts @@ -47,7 +47,7 @@ export default class AddThreepid { private clientSecret: string; private bind: boolean; - constructor() { + public constructor() { this.clientSecret = MatrixClientPeg.get().generateClientSecret(); } diff --git a/src/AsyncWrapper.tsx b/src/AsyncWrapper.tsx index 95cbc2c5181..f6f7edd2c2f 100644 --- a/src/AsyncWrapper.tsx +++ b/src/AsyncWrapper.tsx @@ -47,7 +47,7 @@ export default class AsyncWrapper extends React.Component { error: null, }; - componentDidMount() { + public componentDidMount() { // XXX: temporary logging to try to diagnose // https://github.com/vector-im/element-web/issues/3148 logger.log("Starting load of AsyncWrapper for modal"); @@ -69,7 +69,7 @@ export default class AsyncWrapper extends React.Component { }); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -77,7 +77,7 @@ export default class AsyncWrapper extends React.Component { this.props.onFinished(false); }; - render() { + public render() { if (this.state.component) { const Component = this.state.component; return ; diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index ff5d6fafa72..46a406271c2 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -69,7 +69,7 @@ export default abstract class BasePlatform { protected notificationCount = 0; protected errorDidOccur = false; - constructor() { + public constructor() { dis.register(this.onAction); this.startUpdateCheck = this.startUpdateCheck.bind(this); } diff --git a/src/BlurhashEncoder.ts b/src/BlurhashEncoder.ts index d9a7ab85041..56e137cc012 100644 --- a/src/BlurhashEncoder.ts +++ b/src/BlurhashEncoder.ts @@ -35,7 +35,7 @@ export class BlurhashEncoder { private seq = 0; private pendingDeferredMap = new Map>(); - constructor() { + public constructor() { this.worker = new BlurhashWorker(); this.worker.onmessage = this.onMessage; } diff --git a/src/ContentMessages.ts b/src/ContentMessages.ts index 47d336dc333..f7e7b5277c4 100644 --- a/src/ContentMessages.ts +++ b/src/ContentMessages.ts @@ -598,7 +598,7 @@ export default class ContentMessages { }); } - static sharedInstance() { + public static sharedInstance() { if (window.mxContentMessages === undefined) { window.mxContentMessages = new ContentMessages(); } diff --git a/src/DecryptionFailureTracker.ts b/src/DecryptionFailureTracker.ts index 9756eb30281..c275a176eb7 100644 --- a/src/DecryptionFailureTracker.ts +++ b/src/DecryptionFailureTracker.ts @@ -23,7 +23,7 @@ import { PosthogAnalytics } from "./PosthogAnalytics"; export class DecryptionFailure { public readonly ts: number; - constructor(public readonly failedEventId: string, public readonly errorCode: string) { + public constructor(public readonly failedEventId: string, public readonly errorCode: string) { this.ts = Date.now(); } } @@ -87,14 +87,14 @@ export class DecryptionFailureTracker { public trackInterval: number = null; // Spread the load on `Analytics` by tracking at a low frequency, `TRACK_INTERVAL_MS`. - static TRACK_INTERVAL_MS = 60000; + public static TRACK_INTERVAL_MS = 60000; // Call `checkFailures` every `CHECK_INTERVAL_MS`. - static CHECK_INTERVAL_MS = 5000; + public static CHECK_INTERVAL_MS = 5000; // Give events a chance to be decrypted by waiting `GRACE_PERIOD_MS` before counting // the failure in `failureCounts`. - static GRACE_PERIOD_MS = 4000; + public static GRACE_PERIOD_MS = 4000; /** * Create a new DecryptionFailureTracker. diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index 3621d7a601f..19da52f45bb 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -354,7 +354,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = { }; abstract class BaseHighlighter { - constructor(public highlightClass: string, public highlightLink: string) {} + public constructor(public highlightClass: string, public highlightLink: string) {} /** * apply the highlights to a section of text diff --git a/src/IdentityAuthClient.tsx b/src/IdentityAuthClient.tsx index 8d9040be495..293a3c19a6b 100644 --- a/src/IdentityAuthClient.tsx +++ b/src/IdentityAuthClient.tsx @@ -44,7 +44,7 @@ export default class IdentityAuthClient { * When provided, this class will operate solely within memory, refusing to * persist any information such as tokens. Default null (not provided). */ - constructor(identityUrl?: string) { + public constructor(identityUrl?: string) { if (identityUrl) { // XXX: We shouldn't have to create a whole new MatrixClient just to // do identity server auth. The functions don't take an identity URL diff --git a/src/KeyBindingsManager.ts b/src/KeyBindingsManager.ts index ad02f5413c3..7720c051668 100644 --- a/src/KeyBindingsManager.ts +++ b/src/KeyBindingsManager.ts @@ -105,7 +105,7 @@ export class KeyBindingsManager { * To overwrite the default key bindings add a new providers before the default provider, e.g. a provider for * customized key bindings. */ - bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider]; + public bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider]; /** * Finds a matching KeyAction for a given KeyboardEvent @@ -124,56 +124,56 @@ export class KeyBindingsManager { return undefined; } - getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getMessageComposerBindings), ev, ); } - getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getAutocompleteBindings), ev, ); } - getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getRoomListBindings), ev, ); } - getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getRoomBindings), ev, ); } - getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getNavigationBindings), ev, ); } - getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getAccessibilityBindings), ev, ); } - getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getCallBindings), ev, ); } - getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { + public getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { return this.getAction( this.bindingsProviders.map((it) => it.getLabsBindings), ev, diff --git a/src/Login.ts b/src/Login.ts index 34cd69dd375..ec769e8cb36 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -37,7 +37,7 @@ export default class Login { private defaultDeviceDisplayName: string; private tempClient: MatrixClient; - constructor(hsUrl: string, isUrl: string, fallbackHsUrl?: string, opts?: ILoginOptions) { + public constructor(hsUrl: string, isUrl: string, fallbackHsUrl?: string, opts?: ILoginOptions) { this.hsUrl = hsUrl; this.isUrl = isUrl; this.fallbackHsUrl = fallbackHsUrl; diff --git a/src/Markdown.ts b/src/Markdown.ts index 196def38164..404da0ca8dc 100644 --- a/src/Markdown.ts +++ b/src/Markdown.ts @@ -117,7 +117,7 @@ export default class Markdown { private input: string; private parsed: commonmark.Node; - constructor(input: string) { + public constructor(input: string) { this.input = input; const parser = new commonmark.Parser(); @@ -234,7 +234,7 @@ export default class Markdown { return parsed; } - isPlainText(): boolean { + public isPlainText(): boolean { const walker = this.parsed.walker(); let ev: commonmark.NodeWalkingStep; @@ -257,7 +257,7 @@ export default class Markdown { return true; } - toHTML({ externalLinks = false } = {}): string { + public toHTML({ externalLinks = false } = {}): string { const renderer = new commonmark.HtmlRenderer({ safe: false, @@ -344,7 +344,7 @@ export default class Markdown { * N.B. this does **NOT** render arbitrary MD to plain text - only MD * which has no formatting. Otherwise it emits HTML(!). */ - toPlaintext(): string { + public toPlaintext(): string { const renderer = new commonmark.HtmlRenderer({ safe: false }); renderer.paragraph = function (node: commonmark.Node, entering: boolean) { diff --git a/src/NodeAnimator.tsx b/src/NodeAnimator.tsx index aefb0498062..24b4e85ae37 100644 --- a/src/NodeAnimator.tsx +++ b/src/NodeAnimator.tsx @@ -47,7 +47,7 @@ export default class NodeAnimator extends React.Component { startStyles: [], }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.updateChildren(this.props.children); diff --git a/src/PasswordReset.ts b/src/PasswordReset.ts index f4a7771543c..f6661a35f1f 100644 --- a/src/PasswordReset.ts +++ b/src/PasswordReset.ts @@ -39,7 +39,7 @@ export default class PasswordReset { * @param {string} homeserverUrl The URL to the HS which has the account to reset. * @param {string} identityUrl The URL to the IS which has linked the email -> mxid mapping. */ - constructor(homeserverUrl: string, identityUrl: string) { + public constructor(homeserverUrl: string, identityUrl: string) { this.client = createClient({ baseUrl: homeserverUrl, idBaseUrl: identityUrl, diff --git a/src/PosthogAnalytics.ts b/src/PosthogAnalytics.ts index 2f6b46960bb..1f1a0188140 100644 --- a/src/PosthogAnalytics.ts +++ b/src/PosthogAnalytics.ts @@ -146,7 +146,7 @@ export class PosthogAnalytics { return this._instance; } - constructor(private readonly posthog: PostHog) { + public constructor(private readonly posthog: PostHog) { const posthogConfig = SdkConfig.getObject("posthog"); if (posthogConfig) { this.posthog.init(posthogConfig.get("project_api_key"), { diff --git a/src/PosthogTrackers.ts b/src/PosthogTrackers.ts index 9aa2561c9f1..09c7225a3d3 100644 --- a/src/PosthogTrackers.ts +++ b/src/PosthogTrackers.ts @@ -107,20 +107,20 @@ export default class PosthogTrackers { } export class PosthogScreenTracker extends PureComponent<{ screenName: ScreenName }> { - componentDidMount() { + public componentDidMount() { PosthogTrackers.instance.trackOverride(this.props.screenName); } - componentDidUpdate() { + public componentDidUpdate() { // We do not clear the old override here so that we do not send the non-override screen as a transition PosthogTrackers.instance.trackOverride(this.props.screenName); } - componentWillUnmount() { + public componentWillUnmount() { PosthogTrackers.instance.clearOverride(this.props.screenName); } - render() { + public render() { return null; // no need to render anything, we just need to hook into the React lifecycle } } diff --git a/src/ScalarAuthClient.ts b/src/ScalarAuthClient.ts index be7b85eca82..baa6e6f6328 100644 --- a/src/ScalarAuthClient.ts +++ b/src/ScalarAuthClient.ts @@ -36,7 +36,7 @@ export default class ScalarAuthClient { private termsInteractionCallback: TermsInteractionCallback; private isDefaultManager: boolean; - constructor(private apiUrl: string, private uiUrl: string) { + public constructor(private apiUrl: string, private uiUrl: string) { this.scalarToken = null; // `undefined` to allow `startTermsFlow` to fallback to a default // callback if this is unset. @@ -72,22 +72,22 @@ export default class ScalarAuthClient { return this.readTokenFromStore(); } - setTermsInteractionCallback(callback) { + public setTermsInteractionCallback(callback) { this.termsInteractionCallback = callback; } - connect(): Promise { + public connect(): Promise { return this.getScalarToken().then((tok) => { this.scalarToken = tok; }); } - hasCredentials(): boolean { + public hasCredentials(): boolean { return this.scalarToken != null; // undef or null } // Returns a promise that resolves to a scalar_token string - getScalarToken(): Promise { + public getScalarToken(): Promise { const token = this.readToken(); if (!token) { @@ -169,7 +169,7 @@ export default class ScalarAuthClient { }); } - registerForToken(): Promise { + public registerForToken(): Promise { // Get openid bearer token from the HS as the first part of our dance return MatrixClientPeg.get() .getOpenIdToken() @@ -256,7 +256,7 @@ export default class ScalarAuthClient { } } - getScalarInterfaceUrlForRoom(room: Room, screen: string, id: string): string { + public getScalarInterfaceUrlForRoom(room: Room, screen: string, id: string): string { const roomId = room.roomId; const roomName = room.name; let url = this.uiUrl; @@ -273,7 +273,7 @@ export default class ScalarAuthClient { return url; } - getStarterLink(starterLinkUrl: string): string { + public getStarterLink(starterLinkUrl: string): string { return starterLinkUrl + "?scalar_token=" + encodeURIComponent(this.scalarToken); } } diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index f0cd6613d65..ed72417eccf 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -67,7 +67,7 @@ export function isSecretStorageBeingAccessed(): boolean { } export class AccessCancelledError extends Error { - constructor() { + public constructor() { super("Secret storage access canceled"); } } diff --git a/src/SendHistoryManager.ts b/src/SendHistoryManager.ts index 3f2e17b9d85..1fd8f839bd7 100644 --- a/src/SendHistoryManager.ts +++ b/src/SendHistoryManager.ts @@ -27,12 +27,12 @@ interface IHistoryItem { } export default class SendHistoryManager { - history: Array = []; - prefix: string; - lastIndex = 0; // used for indexing the storage - currentIndex = 0; // used for indexing the loaded validated history Array + public history: Array = []; + public prefix: string; + public lastIndex = 0; // used for indexing the storage + public currentIndex = 0; // used for indexing the loaded validated history Array - constructor(roomId: string, prefix: string) { + public constructor(roomId: string, prefix: string) { this.prefix = prefix + roomId; // TODO: Performance issues? @@ -53,14 +53,14 @@ export default class SendHistoryManager { this.currentIndex = this.lastIndex + 1; } - static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem { + public static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem { return { parts: model.serializeParts(), replyEventId: replyEvent ? replyEvent.getId() : undefined, }; } - save(editorModel: EditorModel, replyEvent?: MatrixEvent) { + public save(editorModel: EditorModel, replyEvent?: MatrixEvent) { const item = SendHistoryManager.createItem(editorModel, replyEvent); this.history.push(item); this.currentIndex = this.history.length; @@ -68,7 +68,7 @@ export default class SendHistoryManager { sessionStorage.setItem(`${this.prefix}[${this.lastIndex}]`, JSON.stringify(item)); } - getItem(offset: number): IHistoryItem { + public getItem(offset: number): IHistoryItem { this.currentIndex = clamp(this.currentIndex + offset, 0, this.history.length - 1); return this.history[this.currentIndex]; } diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index f9d16778472..910c077525c 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -138,7 +138,7 @@ export class Command { public readonly analyticsName?: SlashCommandEvent["command"]; private readonly _isEnabled?: () => boolean; - constructor(opts: ICommandOpts) { + public constructor(opts: ICommandOpts) { this.command = opts.command; this.aliases = opts.aliases || []; this.args = opts.args || ""; diff --git a/src/Terms.ts b/src/Terms.ts index 19041540879..101a778a943 100644 --- a/src/Terms.ts +++ b/src/Terms.ts @@ -34,7 +34,7 @@ export class Service { * @param {string} baseUrl The Base URL of the service (ie. before '/_matrix') * @param {string} accessToken The user's access token for the service */ - constructor(public serviceType: SERVICE_TYPES, public baseUrl: string, public accessToken: string) {} + public constructor(public serviceType: SERVICE_TYPES, public baseUrl: string, public accessToken: string) {} } export interface LocalisedPolicy { diff --git a/src/UserActivity.ts b/src/UserActivity.ts index 35301bbe19d..0e163564e03 100644 --- a/src/UserActivity.ts +++ b/src/UserActivity.ts @@ -45,12 +45,12 @@ export default class UserActivity { private lastScreenX = 0; private lastScreenY = 0; - constructor(private readonly window: Window, private readonly document: Document) { + public constructor(private readonly window: Window, private readonly document: Document) { this.activeNowTimeout = new Timer(CURRENTLY_ACTIVE_THRESHOLD_MS); this.activeRecentlyTimeout = new Timer(RECENTLY_ACTIVE_THRESHOLD_MS); } - static sharedInstance() { + public static sharedInstance() { if (window.mxUserActivity === undefined) { window.mxUserActivity = new UserActivity(window, document); } diff --git a/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx b/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx index 426987a988e..300e67df825 100644 --- a/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx +++ b/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx @@ -38,7 +38,7 @@ interface IState { * Allows the user to disable the Event Index. */ export default class DisableEventIndexDialog extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { disabling: false, diff --git a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx index 04e14422bf4..98bbb55069b 100644 --- a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx +++ b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx @@ -43,7 +43,7 @@ interface IState { * Allows the user to introspect the event index state and disable it. */ export default class ManageEventIndexDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -56,7 +56,7 @@ export default class ManageEventIndexDialog extends React.Component { + public updateCurrentRoom = async (room) => { const eventIndex = EventIndexPeg.get(); let stats; @@ -84,7 +84,7 @@ export default class ManageEventIndexDialog extends React.Component { + public async componentDidMount(): Promise { let eventIndexSize = 0; let crawlingRoomsCount = 0; let roomCount = 0; @@ -141,7 +141,7 @@ export default class ManageEventIndexDialog extends React.Component(); private passphraseField = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index cf0c16046cf..0c976ec599c 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -104,7 +104,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent(); private passphraseField = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let passPhraseKeySelected; diff --git a/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx b/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx index 7d451d55298..1998c7c7ed3 100644 --- a/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx +++ b/src/async-components/views/dialogs/security/ExportE2eKeysDialog.tsx @@ -48,7 +48,7 @@ type AnyPassphrase = KeysStartingWith; export default class ExportE2eKeysDialog extends React.Component { private unmounted = false; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx b/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx index c2b7155f66b..b546ffc91ac 100644 --- a/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx +++ b/src/async-components/views/dialogs/security/ImportE2eKeysDialog.tsx @@ -57,7 +57,7 @@ export default class ImportE2eKeysDialog extends React.Component private unmounted = false; private file = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/audio/Playback.ts b/src/audio/Playback.ts index f74a1254e52..d5971ad73cd 100644 --- a/src/audio/Playback.ts +++ b/src/audio/Playback.ts @@ -83,7 +83,7 @@ export class Playback extends EventEmitter implements IDestroyable, PlaybackInte * @param {number[]} seedWaveform Optional seed waveform to present until the proper waveform * can be calculated. Contains values between zero and one, inclusive. */ - constructor(private buf: ArrayBuffer, seedWaveform = DEFAULT_WAVEFORM) { + public constructor(private buf: ArrayBuffer, seedWaveform = DEFAULT_WAVEFORM) { super(); // Capture the file size early as reading the buffer will result in a 0-length buffer left behind this.fileSize = this.buf.byteLength; diff --git a/src/audio/PlaybackQueue.ts b/src/audio/PlaybackQueue.ts index 78ed653919e..1ea8a85fa64 100644 --- a/src/audio/PlaybackQueue.ts +++ b/src/audio/PlaybackQueue.ts @@ -48,7 +48,7 @@ export class PlaybackQueue { private currentPlaybackId: string; // event ID, broken out from above for ease of use private recentFullPlays = new Set(); // event IDs - constructor(private room: Room) { + public constructor(private room: Room) { this.loadClocks(); SdkContextClass.instance.roomViewStore.addRoomListener(this.room.roomId, (isActive) => { diff --git a/src/audio/RecorderWorklet.ts b/src/audio/RecorderWorklet.ts index bd4705ebf27..5079ec58a9a 100644 --- a/src/audio/RecorderWorklet.ts +++ b/src/audio/RecorderWorklet.ts @@ -43,7 +43,7 @@ class MxVoiceWorklet extends AudioWorkletProcessor { private nextAmplitudeSecond = 0; private amplitudeIndex = 0; - process(inputs, outputs, parameters) { + public process(inputs, outputs, parameters) { const currentSecond = roundTimeToTargetFreq(currentTime); // We special case the first ping because there's a fairly good chance that we'll miss the zeroth // update. Firefox for instance takes 0.06 seconds (roughly) to call this function for the first diff --git a/src/audio/VoiceMessageRecording.ts b/src/audio/VoiceMessageRecording.ts index c1b98e696f8..f27fc36135f 100644 --- a/src/audio/VoiceMessageRecording.ts +++ b/src/audio/VoiceMessageRecording.ts @@ -136,7 +136,7 @@ export class VoiceMessageRecording implements IDestroyable { return this.voiceRecording.isSupported; } - destroy(): void { + public destroy(): void { this.playback?.destroy(); this.voiceRecording.destroy(); } diff --git a/src/autocomplete/AutocompleteProvider.tsx b/src/autocomplete/AutocompleteProvider.tsx index ccc3a3c1c86..e76c4f19039 100644 --- a/src/autocomplete/AutocompleteProvider.tsx +++ b/src/autocomplete/AutocompleteProvider.tsx @@ -36,8 +36,8 @@ export interface IAutocompleteOptions { } export default abstract class AutocompleteProvider { - commandRegex: RegExp; - forcedCommandRegex: RegExp; + public commandRegex: RegExp; + public forcedCommandRegex: RegExp; protected renderingType: TimelineRenderingType = TimelineRenderingType.Room; @@ -59,7 +59,7 @@ export default abstract class AutocompleteProvider { } } - destroy() { + public destroy() { // stub } @@ -70,7 +70,7 @@ export default abstract class AutocompleteProvider { * @param {boolean} force True if the user is forcing completion * @return {object} { command, range } where both objects fields are null if no match */ - getCurrentCommand(query: string, selection: ISelectionRange, force = false) { + public getCurrentCommand(query: string, selection: ISelectionRange, force = false) { let commandRegex = this.commandRegex; if (force && this.shouldForceComplete()) { @@ -106,19 +106,19 @@ export default abstract class AutocompleteProvider { }; } - abstract getCompletions( + public abstract getCompletions( query: string, selection: ISelectionRange, force: boolean, limit: number, ): Promise; - abstract getName(): string; + public abstract getName(): string; - abstract renderCompletions(completions: React.ReactNode[]): React.ReactNode | null; + public abstract renderCompletions(completions: React.ReactNode[]): React.ReactNode | null; // Whether we should provide completions even if triggered forcefully, without a sigil. - shouldForceComplete(): boolean { + public shouldForceComplete(): boolean { return false; } } diff --git a/src/autocomplete/Autocompleter.ts b/src/autocomplete/Autocompleter.ts index 212cefdc187..67a40db158c 100644 --- a/src/autocomplete/Autocompleter.ts +++ b/src/autocomplete/Autocompleter.ts @@ -59,23 +59,23 @@ export interface IProviderCompletions { } export default class Autocompleter { - room: Room; - providers: AutocompleteProvider[]; + public room: Room; + public providers: AutocompleteProvider[]; - constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) { + public constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) { this.room = room; this.providers = PROVIDERS.map((Prov) => { return new Prov(room, renderingType); }); } - destroy() { + public destroy() { this.providers.forEach((p) => { p.destroy(); }); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force = false, diff --git a/src/autocomplete/CommandProvider.tsx b/src/autocomplete/CommandProvider.tsx index 061f5f223d8..68850a9a151 100644 --- a/src/autocomplete/CommandProvider.tsx +++ b/src/autocomplete/CommandProvider.tsx @@ -31,9 +31,9 @@ import { TimelineRenderingType } from "../contexts/RoomContext"; const COMMAND_RE = /(^\/\w*)(?: .*)?/g; export default class CommandProvider extends AutocompleteProvider { - matcher: QueryMatcher; + public matcher: QueryMatcher; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: COMMAND_RE, renderingType }); this.matcher = new QueryMatcher(Commands, { keys: ["command", "args", "description"], @@ -42,7 +42,7 @@ export default class CommandProvider extends AutocompleteProvider { }); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force?: boolean, @@ -100,11 +100,11 @@ export default class CommandProvider extends AutocompleteProvider { }); } - getName() { + public getName() { return "*️⃣ " + _t("Commands"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
; - nameMatcher: QueryMatcher; + public matcher: QueryMatcher; + public nameMatcher: QueryMatcher; private readonly recentlyUsed: IEmoji[]; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: EMOJI_REGEX, renderingType }); this.matcher = new QueryMatcher(SORTED_EMOJI, { keys: [], @@ -93,7 +93,7 @@ export default class EmojiProvider extends AutocompleteProvider { this.recentlyUsed = Array.from(new Set(recent.get().map(getEmojiFromUnicode).filter(Boolean))); } - async getCompletions( + public async getCompletions( query: string, selection: ISelectionRange, force?: boolean, @@ -154,11 +154,11 @@ export default class EmojiProvider extends AutocompleteProvider { return []; } - getName() { + public getName() { return "😃 " + _t("Emoji"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
{ + public async getCompletions( + query: string, + selection: ISelectionRange, + force = false, + limit = -1, + ): Promise { const client = MatrixClientPeg.get(); if (!this.room.currentState.mayTriggerNotifOfType("room", client.credentials.userId)) return []; @@ -60,11 +65,11 @@ export default class NotifProvider extends AutocompleteProvider { return []; } - getName() { + public getName() { return "❗️ " + _t("Room Notification"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
{ private _options: IOptions; private _items: Map; - constructor(objects: T[], options: IOptions = { keys: [] }) { + public constructor(objects: T[], options: IOptions = { keys: [] }) { this._options = options; this.setObjects(objects); @@ -61,7 +61,7 @@ export default class QueryMatcher { } } - setObjects(objects: T[]) { + public setObjects(objects: T[]) { this._items = new Map(); for (const object of objects) { @@ -96,7 +96,7 @@ export default class QueryMatcher { } } - match(query: string, limit = -1): T[] { + public match(query: string, limit = -1): T[] { query = this.processQuery(query); if (this._options.shouldMatchWordsOnly) { query = query.replace(/[^\w]/g, ""); diff --git a/src/autocomplete/RoomProvider.tsx b/src/autocomplete/RoomProvider.tsx index 596ef113b0c..a225676898e 100644 --- a/src/autocomplete/RoomProvider.tsx +++ b/src/autocomplete/RoomProvider.tsx @@ -48,7 +48,7 @@ function matcherObject(room: Room, displayedAlias: string, matchName = "") { export default class RoomProvider extends AutocompleteProvider { protected matcher: QueryMatcher; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: ROOM_REGEX, renderingType }); this.matcher = new QueryMatcher([], { keys: ["displayedAlias", "matchName"], @@ -62,7 +62,12 @@ export default class RoomProvider extends AutocompleteProvider { return cli.getVisibleRooms().filter((r) => !r.isSpaceRoom()); } - async getCompletions(query: string, selection: ISelectionRange, force = false, limit = -1): Promise { + public async getCompletions( + query: string, + selection: ISelectionRange, + force = false, + limit = -1, + ): Promise { let completions = []; const { command, range } = this.getCurrentCommand(query, selection, force); if (command) { @@ -118,11 +123,11 @@ export default class RoomProvider extends AutocompleteProvider { return completions; } - getName() { + public getName() { return _t("Rooms"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
r.isSpaceRoom()); } - getName() { + public getName() { return _t("Spaces"); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
; - users: RoomMember[]; - room: Room; + public matcher: QueryMatcher; + public users: RoomMember[]; + public room: Room; - constructor(room: Room, renderingType?: TimelineRenderingType) { + public constructor(room: Room, renderingType?: TimelineRenderingType) { super({ commandRegex: USER_REGEX, forcedCommandRegex: FORCED_USER_REGEX, @@ -64,7 +64,7 @@ export default class UserProvider extends AutocompleteProvider { MatrixClientPeg.get().on(RoomStateEvent.Update, this.onRoomStateUpdate); } - destroy() { + public destroy() { if (MatrixClientPeg.get()) { MatrixClientPeg.get().removeListener(RoomEvent.Timeline, this.onRoomTimeline); MatrixClientPeg.get().removeListener(RoomStateEvent.Update, this.onRoomStateUpdate); @@ -101,7 +101,7 @@ export default class UserProvider extends AutocompleteProvider { this.users = null; }; - async getCompletions( + public async getCompletions( rawQuery: string, selection: ISelectionRange, force = false, @@ -146,7 +146,7 @@ export default class UserProvider extends AutocompleteProvider { return completions; } - getName(): string { + public getName(): string { return _t("Users"); } @@ -167,7 +167,7 @@ export default class UserProvider extends AutocompleteProvider { this.matcher.setObjects(this.users); } - onUserSpoke(user: RoomMember) { + public onUserSpoke(user: RoomMember) { if (!this.users) return; if (!user) return; if (user.userId === MatrixClientPeg.get().credentials.userId) return; @@ -182,7 +182,7 @@ export default class UserProvider extends AutocompleteProvider { this.matcher.setObjects(this.users); } - renderCompletions(completions: React.ReactNode[]): React.ReactNode { + public renderCompletions(completions: React.ReactNode[]): React.ReactNode { return (
= DynamicHtmlElementPr }; export default class AutoHideScrollbar extends React.Component> { - static defaultProps = { + public static defaultProps = { element: "div" as keyof ReactHTML, }; diff --git a/src/components/structures/ContextMenu.tsx b/src/components/structures/ContextMenu.tsx index ddee8bf1165..6dbdc4a7eb6 100644 --- a/src/components/structures/ContextMenu.tsx +++ b/src/components/structures/ContextMenu.tsx @@ -112,12 +112,12 @@ interface IState { export default class ContextMenu extends React.PureComponent { private readonly initialFocus: HTMLElement; - static defaultProps = { + public static defaultProps = { hasBackground: true, managed: true, }; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -447,7 +447,7 @@ export default class ContextMenu extends React.PureComponent { ); } - render(): React.ReactChild { + public render(): React.ReactChild { if (this.props.mountAsChild) { // Render as a child of the current parent return this.renderMenu(); diff --git a/src/components/structures/EmbeddedPage.tsx b/src/components/structures/EmbeddedPage.tsx index 0b862b7f1d8..d531e4fcc4f 100644 --- a/src/components/structures/EmbeddedPage.tsx +++ b/src/components/structures/EmbeddedPage.tsx @@ -48,7 +48,7 @@ export default class EmbeddedPage extends React.PureComponent { private unmounted = false; private dispatcherRef: string = null; - constructor(props: IProps, context: typeof MatrixClientContext) { + public constructor(props: IProps, context: typeof MatrixClientContext) { super(props, context); this.state = { diff --git a/src/components/structures/FilePanel.tsx b/src/components/structures/FilePanel.tsx index 9c46e8861bb..6efa4f857aa 100644 --- a/src/components/structures/FilePanel.tsx +++ b/src/components/structures/FilePanel.tsx @@ -51,7 +51,7 @@ interface IState { * Component which shows the filtered file using a TimelinePanel */ class FilePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; // This is used to track if a decrypted event was a live event and should be // added to the timeline. @@ -59,7 +59,7 @@ class FilePanel extends React.Component { public noRoom: boolean; private card = createRef(); - state = { + public state = { timelineSet: null, narrow: false, }; diff --git a/src/components/structures/GenericErrorPage.tsx b/src/components/structures/GenericErrorPage.tsx index 5e5da9c10ad..4179abe7fd1 100644 --- a/src/components/structures/GenericErrorPage.tsx +++ b/src/components/structures/GenericErrorPage.tsx @@ -22,7 +22,7 @@ interface IProps { } export default class GenericErrorPage extends React.PureComponent { - render() { + public render() { return (
diff --git a/src/components/structures/IndicatorScrollbar.tsx b/src/components/structures/IndicatorScrollbar.tsx index 206d18fb4a3..1476198239a 100644 --- a/src/components/structures/IndicatorScrollbar.tsx +++ b/src/components/structures/IndicatorScrollbar.tsx @@ -47,7 +47,7 @@ export default class IndicatorScrollbar e private likelyTrackpadUser: boolean = null; private checkAgainForTrackpad = 0; // ts in milliseconds to recheck this._likelyTrackpadUser - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/InteractiveAuth.tsx b/src/components/structures/InteractiveAuth.tsx index d788377bffc..b5582323bf5 100644 --- a/src/components/structures/InteractiveAuth.tsx +++ b/src/components/structures/InteractiveAuth.tsx @@ -99,7 +99,7 @@ export default class InteractiveAuthComponent extends React.Component { private focusedElement = null; private isDoingStickyHeaders = false; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/LegacyCallEventGrouper.ts b/src/components/structures/LegacyCallEventGrouper.ts index 3bc9abd3f4f..9a4d82a9f83 100644 --- a/src/components/structures/LegacyCallEventGrouper.ts +++ b/src/components/structures/LegacyCallEventGrouper.ts @@ -75,7 +75,7 @@ export default class LegacyCallEventGrouper extends EventEmitter { private call: MatrixCall; public state: CallState | CustomCallState; - constructor() { + public constructor() { super(); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallsChanged, this.setCall); diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 40bb3949803..f0e48f44bea 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -125,7 +125,7 @@ interface IState { * Components mounted below us can access the matrix client via the react context. */ class LoggedInView extends React.Component { - static displayName = "LoggedInView"; + public static displayName = "LoggedInView"; protected readonly _matrixClient: MatrixClient; protected readonly _roomView: React.RefObject; @@ -136,7 +136,7 @@ class LoggedInView extends React.Component { protected backgroundImageWatcherRef: string; protected resizer: Resizer; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -159,7 +159,7 @@ class LoggedInView extends React.Component { this.resizeHandler = React.createRef(); } - componentDidMount() { + public componentDidMount() { document.addEventListener("keydown", this.onNativeKeyDown, false); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallState, this.onCallState); @@ -191,7 +191,7 @@ class LoggedInView extends React.Component { this.refreshBackgroundImage(); } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("keydown", this.onNativeKeyDown, false); LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallState, this.onCallState); this._matrixClient.removeListener(ClientEvent.AccountData, this.onAccountData); @@ -621,7 +621,7 @@ class LoggedInView extends React.Component { } }; - render() { + public render() { let pageElement; switch (this.props.page_type) { diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 97d623a1739..536626f2708 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -210,9 +210,9 @@ interface IState { } export default class MatrixChat extends React.PureComponent { - static displayName = "MatrixChat"; + public static displayName = "MatrixChat"; - static defaultProps = { + public static defaultProps = { realQueryParams: {}, startingFragmentQueryParams: {}, config: {}, @@ -237,7 +237,7 @@ export default class MatrixChat extends React.PureComponent { private readonly fontWatcher: FontWatcher; private readonly stores: SdkContextClass; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.stores = SdkContextClass.instance; this.stores.constructEagerStores(); @@ -417,7 +417,7 @@ export default class MatrixChat extends React.PureComponent { window.addEventListener("resize", this.onWindowResized); } - componentDidUpdate(prevProps, prevState) { + public componentDidUpdate(prevProps, prevState) { if (this.shouldTrackPageChange(prevState, this.state)) { const durationMs = this.stopPageChangeTimer(); PosthogTrackers.instance.trackPageChange(this.state.view, this.state.page_type, durationMs); @@ -428,7 +428,7 @@ export default class MatrixChat extends React.PureComponent { } } - componentWillUnmount() { + public componentWillUnmount() { Lifecycle.stopMatrixClient(); dis.unregister(this.dispatcherRef); this.themeWatcher.stop(); @@ -2016,7 +2016,7 @@ export default class MatrixChat extends React.PureComponent { return fragmentAfterLogin; } - render() { + public render() { const fragmentAfterLogin = this.getFragmentAfterLogin(); let view = null; diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index 16cdabc2a19..8942f0abd48 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -214,10 +214,10 @@ interface IReadReceiptForUser { /* (almost) stateless UI component which builds the event tiles in the room timeline. */ export default class MessagePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; - static defaultProps = { + public static defaultProps = { disableGrouping: false, }; @@ -272,7 +272,7 @@ export default class MessagePanel extends React.Component { // A map to allow groupers to maintain consistent keys even if their first event is uprooted due to back-pagination. public grouperKeyMap = new WeakMap(); - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -296,19 +296,19 @@ export default class MessagePanel extends React.Component { ); } - componentDidMount() { + public componentDidMount() { this.calculateRoomMembersCount(); this.props.room?.currentState.on(RoomStateEvent.Update, this.calculateRoomMembersCount); this.isMounted = true; } - componentWillUnmount() { + public componentWillUnmount() { this.isMounted = false; this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount); SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef); } - componentDidUpdate(prevProps, prevState) { + public componentDidUpdate(prevProps, prevState) { if (prevProps.layout !== this.props.layout) { this.calculateRoomMembersCount(); } @@ -982,7 +982,7 @@ export default class MessagePanel extends React.Component { } } - render() { + public render() { let topSpinner; let bottomSpinner; if (this.props.backPaginating) { @@ -1057,14 +1057,14 @@ export default class MessagePanel extends React.Component { } abstract class BaseGrouper { - static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true; + public static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true; public events: MatrixEvent[] = []; // events that we include in the group but then eject out and place above the group. public ejectedEvents: MatrixEvent[] = []; public readMarker: ReactNode; - constructor( + public constructor( public readonly panel: MessagePanel, public readonly event: MatrixEvent, public readonly prevEvent: MatrixEvent, @@ -1097,7 +1097,7 @@ abstract class BaseGrouper { // Grouping only events sent by the same user that sent the `m.room.create` and only until // the first non-state event, beacon_info event or membership event which is not regarding the sender of the `m.room.create` event class CreationGrouper extends BaseGrouper { - static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { + public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { return ev.getType() === EventType.RoomCreate; }; @@ -1231,7 +1231,7 @@ class CreationGrouper extends BaseGrouper { // Wrap consecutive grouped events in a ListSummary class MainGrouper extends BaseGrouper { - static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { + public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean { if (!panel.shouldShowEvent(ev)) return false; if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) { @@ -1249,7 +1249,7 @@ class MainGrouper extends BaseGrouper { return false; }; - constructor( + public constructor( public readonly panel: MessagePanel, public readonly event: MatrixEvent, public readonly prevEvent: MatrixEvent, diff --git a/src/components/structures/NotificationPanel.tsx b/src/components/structures/NotificationPanel.tsx index c43d125e66c..cf3f3e0fbaf 100644 --- a/src/components/structures/NotificationPanel.tsx +++ b/src/components/structures/NotificationPanel.tsx @@ -38,11 +38,11 @@ interface IState { * Component which shows the global notification list using a TimelinePanel */ export default class NotificationPanel extends React.PureComponent { - static contextType = RoomContext; + public static contextType = RoomContext; private card = React.createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -54,7 +54,7 @@ export default class NotificationPanel extends React.PureComponent

{_t("You're all caught up")}

diff --git a/src/components/structures/RightPanel.tsx b/src/components/structures/RightPanel.tsx index 3d5295391ce..87591600571 100644 --- a/src/components/structures/RightPanel.tsx +++ b/src/components/structures/RightPanel.tsx @@ -60,10 +60,10 @@ interface IState { } export default class RightPanel extends React.Component { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { diff --git a/src/components/structures/RoomSearch.tsx b/src/components/structures/RoomSearch.tsx index 1f8c95134b1..6c7ddbe7559 100644 --- a/src/components/structures/RoomSearch.tsx +++ b/src/components/structures/RoomSearch.tsx @@ -33,7 +33,7 @@ interface IProps { export default class RoomSearch extends React.PureComponent { private readonly dispatcherRef: string; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.dispatcherRef = defaultDispatcher.register(this.onAction); diff --git a/src/components/structures/RoomStatusBar.tsx b/src/components/structures/RoomStatusBar.tsx index 2ce359c6865..7d621afc5d7 100644 --- a/src/components/structures/RoomStatusBar.tsx +++ b/src/components/structures/RoomStatusBar.tsx @@ -89,7 +89,7 @@ export default class RoomStatusBar extends React.PureComponent { private unmounted = false; public static contextType = MatrixClientContext; - constructor(props: IProps, context: typeof MatrixClientContext) { + public constructor(props: IProps, context: typeof MatrixClientContext) { super(props, context); this.state = { diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 24b049a16b7..3de552d1d01 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -371,10 +371,10 @@ export class RoomView extends React.Component { private messagePanel: TimelinePanel; private roomViewBody = createRef(); - static contextType = SDKContext; + public static contextType = SDKContext; public context!: React.ContextType; - constructor(props: IRoomProps, context: React.ContextType) { + public constructor(props: IRoomProps, context: React.ContextType) { super(props, context); const llMembers = context.client.hasLazyLoadMembersEnabled(); @@ -838,7 +838,7 @@ export class RoomView extends React.Component { return isManuallyShown && widgets.length > 0; } - componentDidMount() { + public componentDidMount() { this.onRoomViewStoreUpdate(true); const call = this.getCallForRoom(); @@ -851,7 +851,7 @@ export class RoomView extends React.Component { window.addEventListener("beforeunload", this.onPageUnload); } - shouldComponentUpdate(nextProps, nextState) { + public shouldComponentUpdate(nextProps, nextState) { const hasPropsDiff = objectHasDiff(this.props, nextProps); const { upgradeRecommendation, ...state } = this.state; @@ -864,7 +864,7 @@ export class RoomView extends React.Component { return hasPropsDiff || hasStateDiff; } - componentDidUpdate() { + public componentDidUpdate() { // Note: We check the ref here with a flag because componentDidMount, despite // documentation, does not define our messagePanel ref. It looks like our spinner // in render() prevents the ref from being set on first mount, so we try and @@ -877,7 +877,7 @@ export class RoomView extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { // set a boolean to say we've been unmounted, which any pending // promises can use to throw away their results. // @@ -1804,13 +1804,13 @@ export class RoomView extends React.Component { return this.context.client.getRoom(createEvent.getContent()["predecessor"]["room_id"]); } - getHiddenHighlightCount() { + public getHiddenHighlightCount() { const oldRoom = this.getOldRoom(); if (!oldRoom) return 0; return oldRoom.getUnreadNotificationCount(NotificationCountType.Highlight); } - onHiddenHighlightsClick = () => { + public onHiddenHighlightsClick = () => { const oldRoom = this.getOldRoom(); if (!oldRoom) return; dis.dispatch({ @@ -1869,7 +1869,7 @@ export class RoomView extends React.Component { ); } - render() { + public render() { if (this.state.room instanceof LocalRoom) { if (this.state.room.state === LocalRoomState.CREATING) { return this.renderLocalRoomCreateLoader(); diff --git a/src/components/structures/ScrollPanel.tsx b/src/components/structures/ScrollPanel.tsx index 966627d42b7..66676666df7 100644 --- a/src/components/structures/ScrollPanel.tsx +++ b/src/components/structures/ScrollPanel.tsx @@ -195,7 +195,7 @@ export default class ScrollPanel extends React.Component { private heightUpdateInProgress: boolean; private divScroll: HTMLDivElement; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.props.resizeNotifier?.on("middlePanelResizedNoisy", this.onResize); diff --git a/src/components/structures/SearchBox.tsx b/src/components/structures/SearchBox.tsx index 314fc051d36..a0777f2d524 100644 --- a/src/components/structures/SearchBox.tsx +++ b/src/components/structures/SearchBox.tsx @@ -45,7 +45,7 @@ interface IState { export default class SearchBox extends React.Component { private search = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx index b2de0363fcb..6b7929695b6 100644 --- a/src/components/structures/SpaceRoomView.tsx +++ b/src/components/structures/SpaceRoomView.tsx @@ -611,13 +611,13 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => { }; export default class SpaceRoomView extends React.PureComponent { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; private readonly creator: string; private readonly dispatcherRef: string; - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); let phase = Phase.Landing; @@ -642,11 +642,11 @@ export default class SpaceRoomView extends React.PureComponent { RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate); } - componentDidMount() { + public componentDidMount() { this.context.on(RoomEvent.MyMembership, this.onMyMembership); } - componentWillUnmount() { + public componentWillUnmount() { defaultDispatcher.unregister(this.dispatcherRef); RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate); this.context.off(RoomEvent.MyMembership, this.onMyMembership); @@ -794,7 +794,7 @@ export default class SpaceRoomView extends React.PureComponent { } } - render() { + public render() { const rightPanel = this.state.showRightPanel && this.state.phase === Phase.Landing ? ( diff --git a/src/components/structures/TabbedView.tsx b/src/components/structures/TabbedView.tsx index a84c72691ed..7446ab73b3c 100644 --- a/src/components/structures/TabbedView.tsx +++ b/src/components/structures/TabbedView.tsx @@ -37,7 +37,7 @@ export class Tab { * @param {React.ReactNode} body The JSX for the tab container. * @param {string} screenName The screen name to report to Posthog. */ - constructor( + public constructor( public readonly id: string, public readonly label: string, public readonly icon: string, @@ -64,7 +64,7 @@ interface IState { } export default class TabbedView extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId); @@ -73,7 +73,7 @@ export default class TabbedView extends React.Component { }; } - static defaultProps = { + public static defaultProps = { tabLocation: TabLocation.LEFT, }; diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index 292cd394d8f..b65a14b3c51 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -76,7 +76,7 @@ interface IState { } export default class ThreadView extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private dispatcherRef: string; @@ -84,7 +84,7 @@ export default class ThreadView extends React.Component { private timelinePanel = createRef(); private card = createRef(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const thread = this.props.room.getThread(this.props.mxEvent.getId()); diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index 743a409834c..214e252fbcb 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -227,13 +227,13 @@ interface IEventIndexOpts { * Also responsible for handling and sending read receipts. */ class TimelinePanel extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; // a map from room id to read marker event timestamp - static roomReadMarkerTsMap: Record = {}; + public static roomReadMarkerTsMap: Record = {}; - static defaultProps = { + public static defaultProps = { // By default, disable the timelineCap in favour of unpaginating based on // event tile heights. (See _unpaginateEvents) timelineCap: Number.MAX_VALUE, @@ -257,7 +257,7 @@ class TimelinePanel extends React.Component { // A map of private callEventGroupers = new Map(); - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); this.context = context; @@ -360,7 +360,7 @@ class TimelinePanel extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { // set a boolean to say we've been unmounted, which any pending // promises can use to throw away their results. // @@ -1883,7 +1883,7 @@ class TimelinePanel extends React.Component { this.callEventGroupers = buildLegacyCallEventGroupers(this.callEventGroupers, events); } - render() { + public render() { // just show a spinner while the timeline loads. // // put it in a div of the right class (mx_RoomView_messagePanel) so diff --git a/src/components/structures/ToastContainer.tsx b/src/components/structures/ToastContainer.tsx index 85699ef1fbe..42d552928fb 100644 --- a/src/components/structures/ToastContainer.tsx +++ b/src/components/structures/ToastContainer.tsx @@ -25,7 +25,7 @@ interface IState { } export default class ToastContainer extends React.Component<{}, IState> { - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { toasts: ToastStore.sharedInstance().getToasts(), @@ -39,7 +39,7 @@ export default class ToastContainer extends React.Component<{}, IState> { ToastStore.sharedInstance().on("update", this.onToastStoreUpdate); } - componentWillUnmount() { + public componentWillUnmount() { ToastStore.sharedInstance().removeListener("update", this.onToastStoreUpdate); } @@ -50,7 +50,7 @@ export default class ToastContainer extends React.Component<{}, IState> { }); }; - render() { + public render() { const totalCount = this.state.toasts.length; const isStacked = totalCount > 1; let toast; diff --git a/src/components/structures/UploadBar.tsx b/src/components/structures/UploadBar.tsx index c48325561b8..c92994cdef2 100644 --- a/src/components/structures/UploadBar.tsx +++ b/src/components/structures/UploadBar.tsx @@ -57,7 +57,7 @@ export default class UploadBar extends React.PureComponent { private dispatcherRef: Optional; private mounted = false; - constructor(props) { + public constructor(props) { super(props); // Set initial state to any available upload in this room - we might be mounting @@ -65,12 +65,12 @@ export default class UploadBar extends React.PureComponent { this.state = this.calculateState(); } - componentDidMount() { + public componentDidMount() { this.dispatcherRef = dis.register(this.onAction); this.mounted = true; } - componentWillUnmount() { + public componentWillUnmount() { this.mounted = false; dis.unregister(this.dispatcherRef!); } @@ -103,7 +103,7 @@ export default class UploadBar extends React.PureComponent { ContentMessages.sharedInstance().cancelUpload(this.state.currentUpload!); }; - render() { + public render() { if (!this.state.currentFile) { return null; } diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 5e6970f85bb..86f1d38deb6 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -93,7 +93,7 @@ export default class UserMenu extends React.Component { private buttonRef: React.RefObject = createRef(); private voiceBroadcastRecordingStore = VoiceBroadcastRecordingsStore.instance(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/UserView.tsx b/src/components/structures/UserView.tsx index 47ba1172b2a..226de3e2336 100644 --- a/src/components/structures/UserView.tsx +++ b/src/components/structures/UserView.tsx @@ -41,7 +41,7 @@ interface IState { } export default class UserView extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { loading: true, diff --git a/src/components/structures/ViewSource.tsx b/src/components/structures/ViewSource.tsx index 7fd75904f55..b87194f251c 100644 --- a/src/components/structures/ViewSource.tsx +++ b/src/components/structures/ViewSource.tsx @@ -40,7 +40,7 @@ interface IState { } export default class ViewSource extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/structures/auth/CompleteSecurity.tsx b/src/components/structures/auth/CompleteSecurity.tsx index 8da8e5c5358..b5d07e53960 100644 --- a/src/components/structures/auth/CompleteSecurity.tsx +++ b/src/components/structures/auth/CompleteSecurity.tsx @@ -33,7 +33,7 @@ interface IState { } export default class CompleteSecurity extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const store = SetupEncryptionStore.sharedInstance(); store.on("update", this.onStoreUpdate); diff --git a/src/components/structures/auth/E2eSetup.tsx b/src/components/structures/auth/E2eSetup.tsx index c3ee9051508..f1fc6378e32 100644 --- a/src/components/structures/auth/E2eSetup.tsx +++ b/src/components/structures/auth/E2eSetup.tsx @@ -27,7 +27,7 @@ interface IProps { } export default class E2eSetup extends React.Component { - render() { + public render() { return ( diff --git a/src/components/structures/auth/ForgotPassword.tsx b/src/components/structures/auth/ForgotPassword.tsx index 208c29115e9..eef3962e7fa 100644 --- a/src/components/structures/auth/ForgotPassword.tsx +++ b/src/components/structures/auth/ForgotPassword.tsx @@ -350,7 +350,7 @@ export default class ForgotPassword extends React.Component { } as any); }; - renderEnterEmail(): JSX.Element { + public renderEnterEmail(): JSX.Element { return ( { ); } - async renderConfirmLogoutDevicesDialog(): Promise { + public async renderConfirmLogoutDevicesDialog(): Promise { const { finished } = Modal.createDialog<[boolean]>(QuestionDialog, { title: _t("Warning!"), description: ( @@ -395,7 +395,7 @@ export default class ForgotPassword extends React.Component { return confirmed; } - renderCheckEmail(): JSX.Element { + public renderCheckEmail(): JSX.Element { return ( { ); } - renderSetPassword(): JSX.Element { + public renderSetPassword(): JSX.Element { const submitButtonChild = this.state.phase === Phase.ResettingPassword ? : _t("Reset password"); @@ -460,7 +460,7 @@ export default class ForgotPassword extends React.Component { ); } - renderDone() { + public renderDone() { return ( <> @@ -484,7 +484,7 @@ export default class ForgotPassword extends React.Component { ); } - render() { + public render() { let resetPasswordJsx: JSX.Element; switch (this.state.phase) { diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index a8612d7a18b..49d826c74a4 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -110,7 +110,7 @@ export default class LoginComponent extends React.PureComponent private readonly stepRendererMap: Record ReactNode>; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -148,7 +148,7 @@ export default class LoginComponent extends React.PureComponent this.initLoginLogic(this.props.serverConfig); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -162,9 +162,9 @@ export default class LoginComponent extends React.PureComponent } } - isBusy = () => this.state.busy || this.props.busy; + public isBusy = () => this.state.busy || this.props.busy; - onPasswordLogin = async (username, phoneCountry, phoneNumber, password) => { + public onPasswordLogin = async (username, phoneCountry, phoneNumber, password) => { if (!this.state.serverIsAlive) { this.setState({ busy: true }); // Do a quick liveliness check on the URLs @@ -264,11 +264,11 @@ export default class LoginComponent extends React.PureComponent ); }; - onUsernameChanged = (username) => { + public onUsernameChanged = (username) => { this.setState({ username: username }); }; - onUsernameBlur = async (username) => { + public onUsernameBlur = async (username) => { const doWellknownLookup = username[0] === "@"; this.setState({ username: username, @@ -315,23 +315,23 @@ export default class LoginComponent extends React.PureComponent } }; - onPhoneCountryChanged = (phoneCountry) => { + public onPhoneCountryChanged = (phoneCountry) => { this.setState({ phoneCountry: phoneCountry }); }; - onPhoneNumberChanged = (phoneNumber) => { + public onPhoneNumberChanged = (phoneNumber) => { this.setState({ phoneNumber: phoneNumber, }); }; - onRegisterClick = (ev) => { + public onRegisterClick = (ev) => { ev.preventDefault(); ev.stopPropagation(); this.props.onRegisterClick(); }; - onTryRegisterClick = (ev) => { + public onTryRegisterClick = (ev) => { const hasPasswordFlow = this.state.flows?.find((flow) => flow.type === "m.login.password"); const ssoFlow = this.state.flows?.find((flow) => flow.type === "m.login.sso" || flow.type === "m.login.cas"); // If has no password flow but an SSO flow guess that the user wants to register with SSO. @@ -502,7 +502,7 @@ export default class LoginComponent extends React.PureComponent return errorText; } - renderLoginComponentForFlows() { + public renderLoginComponentForFlows() { if (!this.state.flows) return null; // this is the ideal order we want to show the flows in @@ -553,7 +553,7 @@ export default class LoginComponent extends React.PureComponent ); }; - render() { + public render() { const loader = this.isBusy() && !this.state.busyLoggingIn ? (
diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 5a7a61e1ea4..d65cfd7828f 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -125,7 +125,7 @@ export default class Registration extends React.Component { // `replaceClient` tracks latest serverConfig to spot when it changes under the async method which fetches flows private latestServerConfig: ValidatedServerConfig; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -148,13 +148,13 @@ export default class Registration extends React.Component { }); } - componentDidMount() { + public componentDidMount() { this.replaceClient(this.props.serverConfig); //triggers a confirmation dialog for data loss before page unloads/refreshes window.addEventListener("beforeunload", this.unloadCallback); } - componentWillUnmount() { + public componentWillUnmount() { window.removeEventListener("beforeunload", this.unloadCallback); } @@ -565,7 +565,7 @@ export default class Registration extends React.Component { } } - render() { + public render() { let errorText; const err = this.state.errorText; if (err) { diff --git a/src/components/structures/auth/SetupEncryptionBody.tsx b/src/components/structures/auth/SetupEncryptionBody.tsx index 3f2fb264817..a356b548f1d 100644 --- a/src/components/structures/auth/SetupEncryptionBody.tsx +++ b/src/components/structures/auth/SetupEncryptionBody.tsx @@ -45,7 +45,7 @@ interface IState { } export default class SetupEncryptionBody extends React.Component { - constructor(props) { + public constructor(props) { super(props); const store = SetupEncryptionStore.sharedInstance(); store.on("update", this.onStoreUpdate); diff --git a/src/components/views/audio_messages/AudioPlayerBase.tsx b/src/components/views/audio_messages/AudioPlayerBase.tsx index 4c078c9d865..c054cca5732 100644 --- a/src/components/views/audio_messages/AudioPlayerBase.tsx +++ b/src/components/views/audio_messages/AudioPlayerBase.tsx @@ -42,7 +42,7 @@ export default abstract class AudioPlayerBase extends protected seekRef: RefObject = createRef(); protected playPauseRef: RefObject = createRef(); - constructor(props: T) { + public constructor(props: T) { super(props); // Playback instances can be reused in the composer diff --git a/src/components/views/audio_messages/LiveRecordingClock.tsx b/src/components/views/audio_messages/LiveRecordingClock.tsx index 10005d8b9aa..04bc89e4eb0 100644 --- a/src/components/views/audio_messages/LiveRecordingClock.tsx +++ b/src/components/views/audio_messages/LiveRecordingClock.tsx @@ -39,14 +39,14 @@ export default class LiveRecordingClock extends React.PureComponent requestAnimationFrame(() => this.scheduledUpdate.trigger()), ); - constructor(props) { + public constructor(props) { super(props); this.state = { seconds: 0, }; } - componentDidMount() { + public componentDidMount() { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { this.seconds = update.timeSeconds; this.scheduledUpdate.mark(); diff --git a/src/components/views/audio_messages/LiveRecordingWaveform.tsx b/src/components/views/audio_messages/LiveRecordingWaveform.tsx index 3a546c2a6d5..9cb6d30c36c 100644 --- a/src/components/views/audio_messages/LiveRecordingWaveform.tsx +++ b/src/components/views/audio_messages/LiveRecordingWaveform.tsx @@ -44,14 +44,14 @@ export default class LiveRecordingWaveform extends React.PureComponent requestAnimationFrame(() => this.scheduledUpdate.trigger()), ); - constructor(props) { + public constructor(props) { super(props); this.state = { waveform: arraySeed(0, RECORDING_PLAYBACK_SAMPLES), }; } - componentDidMount() { + public componentDidMount() { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { // The incoming data is between zero and one, so we don't need to clamp/rescale it. this.waveform = arrayFastResample(Array.from(update.waveform), RECORDING_PLAYBACK_SAMPLES); diff --git a/src/components/views/audio_messages/SeekBar.tsx b/src/components/views/audio_messages/SeekBar.tsx index 423c1a7ccdb..9006016b14b 100644 --- a/src/components/views/audio_messages/SeekBar.tsx +++ b/src/components/views/audio_messages/SeekBar.tsx @@ -56,7 +56,7 @@ export default class SeekBar extends React.PureComponent { disabled: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index f7acc67c322..14a2073d277 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -34,14 +34,14 @@ interface ICaptchaFormState { * A pure UI component which displays a captcha form. */ export default class CaptchaForm extends React.Component { - static defaultProps = { + public static defaultProps = { onCaptchaResponse: () => {}, }; private captchaWidgetId?: string; private recaptchaContainer = createRef(); - constructor(props: ICaptchaFormProps) { + public constructor(props: ICaptchaFormProps) { super(props); this.state = { @@ -49,7 +49,7 @@ export default class CaptchaForm extends React.Component{this.state.errorText}
; diff --git a/src/components/views/auth/CountryDropdown.tsx b/src/components/views/auth/CountryDropdown.tsx index 691e49e39a3..ae155696c02 100644 --- a/src/components/views/auth/CountryDropdown.tsx +++ b/src/components/views/auth/CountryDropdown.tsx @@ -53,7 +53,7 @@ interface IState { } export default class CountryDropdown extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0]; diff --git a/src/components/views/auth/EmailField.tsx b/src/components/views/auth/EmailField.tsx index 02595e17ca2..4af61eaaf02 100644 --- a/src/components/views/auth/EmailField.tsx +++ b/src/components/views/auth/EmailField.tsx @@ -39,7 +39,7 @@ interface IProps extends Omit { } class EmailField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Email"), labelRequired: _td("Enter email address"), labelInvalid: _td("Doesn't look like a valid email address"), @@ -60,7 +60,7 @@ class EmailField extends PureComponent { ], }); - onValidate = async (fieldState: IFieldState) => { + public onValidate = async (fieldState: IFieldState) => { let validate = this.validate; if (this.props.validationRules) { validate = this.props.validationRules; @@ -74,7 +74,7 @@ class EmailField extends PureComponent { return result; }; - render() { + public render() { return ( { - static LOGIN_TYPE = AuthType.Password; + public static LOGIN_TYPE = AuthType.Password; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -108,7 +108,7 @@ export class PasswordAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Recaptcha; + public static LOGIN_TYPE = AuthType.Recaptcha; - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } @@ -207,7 +207,7 @@ export class RecaptchaAuthEntry extends React.Component; } @@ -262,9 +262,9 @@ interface ITermsAuthEntryState { } export class TermsAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Terms; + public static LOGIN_TYPE = AuthType.Terms; - constructor(props) { + public constructor(props) { super(props); // example stageParams: @@ -320,7 +320,7 @@ export class TermsAuthEntry extends React.Component; } @@ -423,9 +423,9 @@ export class EmailIdentityAuthEntry extends React.Component< IEmailIdentityAuthEntryProps, IEmailIdentityAuthEntryState > { - static LOGIN_TYPE = AuthType.Email; + public static LOGIN_TYPE = AuthType.Email; - constructor(props: IEmailIdentityAuthEntryProps) { + public constructor(props: IEmailIdentityAuthEntryProps) { super(props); this.state = { @@ -434,11 +434,11 @@ export class EmailIdentityAuthEntry extends React.Component< }; } - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } - render() { + public render() { let errorSection; // ignore the error when errcode is M_UNAUTHORIZED as we expect that error until the link is clicked. if (this.props.errorText && this.props.errorCode !== "M_UNAUTHORIZED") { @@ -549,13 +549,13 @@ interface IMsisdnAuthEntryState { } export class MsisdnAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Msisdn; + public static LOGIN_TYPE = AuthType.Msisdn; private submitUrl: string; private sid: string; private msisdn: string; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -565,7 +565,7 @@ export class MsisdnAuthEntry extends React.Component; } else { @@ -704,16 +704,16 @@ interface ISSOAuthEntryState { } export class SSOAuthEntry extends React.Component { - static LOGIN_TYPE = AuthType.Sso; - static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable; + public static LOGIN_TYPE = AuthType.Sso; + public static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable; - static PHASE_PREAUTH = 1; // button to start SSO - static PHASE_POSTAUTH = 2; // button to confirm SSO completed + public static PHASE_PREAUTH = 1; // button to start SSO + public static PHASE_POSTAUTH = 2; // button to confirm SSO completed private ssoUrl: string; private popupWindow: Window; - constructor(props) { + public constructor(props) { super(props); // We actually send the user through fallback auth so we don't have to @@ -729,11 +729,11 @@ export class SSOAuthEntry extends React.Component { private popupWindow: Window; private fallbackButton = createRef(); - constructor(props) { + public constructor(props) { super(props); // we have to make the user click a button, as browsers will block @@ -834,11 +834,11 @@ export class FallbackAuthEntry extends React.Component { window.addEventListener("message", this.onReceiveMessage); } - componentDidMount() { + public componentDidMount() { this.props.onPhaseChange(DEFAULT_PHASE); } - componentWillUnmount() { + public componentWillUnmount() { window.removeEventListener("message", this.onReceiveMessage); if (this.popupWindow) { this.popupWindow.close(); @@ -865,7 +865,7 @@ export class FallbackAuthEntry extends React.Component { } }; - render() { + public render() { let errorSection; if (this.props.errorText) { errorSection = ( diff --git a/src/components/views/auth/PassphraseConfirmField.tsx b/src/components/views/auth/PassphraseConfirmField.tsx index 38c7c03c77c..85aa43d1a18 100644 --- a/src/components/views/auth/PassphraseConfirmField.tsx +++ b/src/components/views/auth/PassphraseConfirmField.tsx @@ -35,7 +35,7 @@ interface IProps extends Omit { } class PassphraseConfirmField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Confirm password"), labelRequired: _td("Confirm password"), labelInvalid: _td("Passwords don't match"), @@ -65,7 +65,7 @@ class PassphraseConfirmField extends PureComponent { return result; }; - render() { + public render() { return ( { } class PassphraseField extends PureComponent { - static defaultProps = { + public static defaultProps = { label: _td("Password"), labelEnterPassword: _td("Enter password"), labelStrongPassword: _td("Nice, strong password!"), @@ -94,7 +94,7 @@ class PassphraseField extends PureComponent { ], }); - onValidate = async (fieldState: IFieldState) => { + public onValidate = async (fieldState: IFieldState) => { const result = await this.validate(fieldState); if (this.props.onValidate) { this.props.onValidate(result); @@ -102,7 +102,7 @@ class PassphraseField extends PureComponent { return result; }; - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { onUsernameChanged: function () {}, onUsernameBlur: function () {}, onPhoneCountryChanged: function () {}, @@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent { disableSubmit: false, }; - constructor(props) { + public constructor(props) { super(props); this.state = { // Field error codes by field ID @@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent { } } - render() { + public render() { let forgotPasswordJsx; if (this.props.onForgotPasswordClick) { diff --git a/src/components/views/auth/RegistrationForm.tsx b/src/components/views/auth/RegistrationForm.tsx index 366ff3a1d48..3cb305bea0e 100644 --- a/src/components/views/auth/RegistrationForm.tsx +++ b/src/components/views/auth/RegistrationForm.tsx @@ -95,12 +95,12 @@ interface IState { * A pure UI component which displays a registration form. */ export default class RegistrationForm extends React.PureComponent { - static defaultProps = { + public static defaultProps = { onValidationChange: logger.error, canSubmit: true, }; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -468,7 +468,7 @@ export default class RegistrationForm extends React.PureComponent ); diff --git a/src/components/views/avatars/DecoratedRoomAvatar.tsx b/src/components/views/avatars/DecoratedRoomAvatar.tsx index 59618da2631..9022ed5881f 100644 --- a/src/components/views/avatars/DecoratedRoomAvatar.tsx +++ b/src/components/views/avatars/DecoratedRoomAvatar.tsx @@ -82,7 +82,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent { oobData: {}, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/context_menus/DialpadContextMenu.tsx b/src/components/views/context_menus/DialpadContextMenu.tsx index 8e05532430d..1f520cd3d32 100644 --- a/src/components/views/context_menus/DialpadContextMenu.tsx +++ b/src/components/views/context_menus/DialpadContextMenu.tsx @@ -34,7 +34,7 @@ interface IState { export default class DialpadContextMenu extends React.Component { private numberEntryFieldRef: React.RefObject = createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -42,7 +42,7 @@ export default class DialpadContextMenu extends React.Component }; } - onDigitPress = (digit: string, ev: ButtonEvent) => { + public onDigitPress = (digit: string, ev: ButtonEvent) => { this.props.call.sendDtmfDigit(digit); this.setState({ value: this.state.value + digit }); @@ -54,22 +54,22 @@ export default class DialpadContextMenu extends React.Component } }; - onCancelClick = () => { + public onCancelClick = () => { this.props.onFinished(); }; - onKeyDown = (ev) => { + public onKeyDown = (ev) => { // Prevent Backspace and Delete keys from functioning in the entry field if (ev.code === "Backspace" || ev.code === "Delete") { ev.preventDefault(); } }; - onChange = (ev) => { + public onChange = (ev) => { this.setState({ value: ev.target.value }); }; - render() { + public render() { return (
diff --git a/src/components/views/context_menus/GenericElementContextMenu.tsx b/src/components/views/context_menus/GenericElementContextMenu.tsx index 9e90d3dc722..e4b5203acc0 100644 --- a/src/components/views/context_menus/GenericElementContextMenu.tsx +++ b/src/components/views/context_menus/GenericElementContextMenu.tsx @@ -29,7 +29,7 @@ interface IProps { * menu. */ export default class GenericElementContextMenu extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/context_menus/LegacyCallContextMenu.tsx b/src/components/views/context_menus/LegacyCallContextMenu.tsx index 49231a7b686..cb97d09537b 100644 --- a/src/components/views/context_menus/LegacyCallContextMenu.tsx +++ b/src/components/views/context_menus/LegacyCallContextMenu.tsx @@ -26,27 +26,27 @@ interface IProps extends IContextMenuProps { } export default class LegacyCallContextMenu extends React.Component { - constructor(props) { + public constructor(props) { super(props); } - onHoldClick = () => { + public onHoldClick = () => { this.props.call.setRemoteOnHold(true); this.props.onFinished(); }; - onUnholdClick = () => { + public onUnholdClick = () => { LegacyCallHandler.instance.setActiveCallRoomId(this.props.call.roomId); this.props.onFinished(); }; - onTransferClick = () => { + public onTransferClick = () => { LegacyCallHandler.instance.showTransferDialog(this.props.call); this.props.onFinished(); }; - render() { + public render() { const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold"); const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick; diff --git a/src/components/views/context_menus/MessageContextMenu.tsx b/src/components/views/context_menus/MessageContextMenu.tsx index f0c27defde1..ed4c2ab4cb9 100644 --- a/src/components/views/context_menus/MessageContextMenu.tsx +++ b/src/components/views/context_menus/MessageContextMenu.tsx @@ -135,12 +135,12 @@ interface IState { } export default class MessageContextMenu extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private reactButtonRef = createRef(); // XXX Ref to a functional component - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/BaseDialog.tsx b/src/components/views/dialogs/BaseDialog.tsx index a3fa9b33628..2eb5234caa9 100644 --- a/src/components/views/dialogs/BaseDialog.tsx +++ b/src/components/views/dialogs/BaseDialog.tsx @@ -88,7 +88,7 @@ export default class BaseDialog extends React.Component { fixedWidth: true, }; - constructor(props) { + public constructor(props) { super(props); this.matrixClient = MatrixClientPeg.get(); diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 9f88040c6d5..9827f2e7de3 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -54,7 +54,7 @@ interface IState { export default class BugReportDialog extends React.Component { private unmounted: boolean; - constructor(props) { + public constructor(props) { super(props); this.state = { sendLogs: true, diff --git a/src/components/views/dialogs/ChangelogDialog.tsx b/src/components/views/dialogs/ChangelogDialog.tsx index 8d5d05e7dc7..971a952e9c8 100644 --- a/src/components/views/dialogs/ChangelogDialog.tsx +++ b/src/components/views/dialogs/ChangelogDialog.tsx @@ -30,7 +30,7 @@ interface IProps { const REPOS = ["vector-im/element-web", "matrix-org/matrix-react-sdk", "matrix-org/matrix-js-sdk"]; export default class ChangelogDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx index a8947cfebd9..51c8b039730 100644 --- a/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmAndWaitRedactDialog.tsx @@ -45,7 +45,7 @@ interface IState { * To avoid this, we keep the dialog open as long as /redact is in progress. */ export default class ConfirmAndWaitRedactDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { isRedacting: false, diff --git a/src/components/views/dialogs/ConfirmRedactDialog.tsx b/src/components/views/dialogs/ConfirmRedactDialog.tsx index 29a2e476a48..e1052e8d36c 100644 --- a/src/components/views/dialogs/ConfirmRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmRedactDialog.tsx @@ -31,7 +31,7 @@ interface IProps { * A dialog for confirming a redaction. */ export default class ConfirmRedactDialog extends React.Component { - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { danger: false, askReason: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx b/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx index c4796f7e343..86af07c4e21 100644 --- a/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx +++ b/src/components/views/dialogs/ConfirmWipeDeviceDialog.tsx @@ -33,7 +33,7 @@ export default class ConfirmWipeDeviceDialog extends React.Component { this.props.onFinished(false); }; - render() { + public render() { return ( { private nameField = createRef(); private aliasField = createRef(); - constructor(props) { + public constructor(props) { super(props); this.supportsRestricted = !!this.props.parentSpace; @@ -124,7 +124,7 @@ export default class CreateRoomDialog extends React.Component { return opts; } - componentDidMount() { + public componentDidMount() { // move focus to first field when showing dialog this.nameField.current.focus(); } @@ -216,7 +216,7 @@ export default class CreateRoomDialog extends React.Component { ], }); - render() { + public render() { const isVideoRoom = this.props.type === RoomType.ElementVideo; let aliasField: JSX.Element; diff --git a/src/components/views/dialogs/DeactivateAccountDialog.tsx b/src/components/views/dialogs/DeactivateAccountDialog.tsx index bb56a440a33..78b70684846 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.tsx +++ b/src/components/views/dialogs/DeactivateAccountDialog.tsx @@ -46,7 +46,7 @@ interface IState { } export default class DeactivateAccountDialog extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { diff --git a/src/components/views/dialogs/EndPollDialog.tsx b/src/components/views/dialogs/EndPollDialog.tsx index e6e190a667b..6729cc5d753 100644 --- a/src/components/views/dialogs/EndPollDialog.tsx +++ b/src/components/views/dialogs/EndPollDialog.tsx @@ -59,7 +59,7 @@ export default class EndPollDialog extends React.Component { this.props.onFinished(endPoll); }; - render() { + public render() { return ( = React.createRef(); private readonly config: SnakedObject; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/IncomingSasDialog.tsx b/src/components/views/dialogs/IncomingSasDialog.tsx index 68cb728bf8c..097fbd39a87 100644 --- a/src/components/views/dialogs/IncomingSasDialog.tsx +++ b/src/components/views/dialogs/IncomingSasDialog.tsx @@ -56,7 +56,7 @@ interface IState { export default class IncomingSasDialog extends React.Component { private showSasEvent: ISasEvent; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let phase = PHASE_START; diff --git a/src/components/views/dialogs/InfoDialog.tsx b/src/components/views/dialogs/InfoDialog.tsx index 922d1608ae0..d88a82f554d 100644 --- a/src/components/views/dialogs/InfoDialog.tsx +++ b/src/components/views/dialogs/InfoDialog.tsx @@ -34,7 +34,7 @@ interface IProps extends IDialogProps { } export default class InfoDialog extends React.Component { - static defaultProps = { + public static defaultProps = { title: "", description: "", hasCloseButton: false, @@ -44,7 +44,7 @@ export default class InfoDialog extends React.Component { this.props.onFinished(); }; - render() { + public render() { return ( { - constructor(props: InteractiveAuthDialogProps) { + public constructor(props: InteractiveAuthDialogProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/InviteDialog.tsx b/src/components/views/dialogs/InviteDialog.tsx index 6ed866416bf..02dba9091a7 100644 --- a/src/components/views/dialogs/InviteDialog.tsx +++ b/src/components/views/dialogs/InviteDialog.tsx @@ -100,7 +100,7 @@ class DMUserTile extends React.PureComponent { this.props.onRemove(this.props.member); }; - render() { + public render() { const avatarSize = 20; const avatar = ; @@ -187,7 +187,7 @@ class DMRoomTile extends React.PureComponent { return result; } - render() { + public render() { let timestamp = null; if (this.props.lastActiveTs) { const humanTs = humanizeTime(this.props.lastActiveTs); @@ -301,7 +301,7 @@ interface IInviteDialogState { } export default class InviteDialog extends React.PureComponent { - static defaultProps = { + public static defaultProps = { kind: KIND_DM, initialText: "", }; @@ -311,7 +311,7 @@ export default class InviteDialog extends React.PureComponent = createRef(); private unmounted = false; - constructor(props) { + public constructor(props) { super(props); if (props.kind === KIND_INVITE && !props.roomId) { @@ -351,13 +351,13 @@ export default class InviteDialog extends React.PureComponent; diff --git a/src/components/views/dialogs/LogoutDialog.tsx b/src/components/views/dialogs/LogoutDialog.tsx index 3f321e18da3..9a22121c3b1 100644 --- a/src/components/views/dialogs/LogoutDialog.tsx +++ b/src/components/views/dialogs/LogoutDialog.tsx @@ -41,11 +41,11 @@ interface IState { } export default class LogoutDialog extends React.Component { - static defaultProps = { + public static defaultProps = { onFinished: function () {}, }; - constructor(props) { + public constructor(props) { super(props); const cli = MatrixClientPeg.get(); @@ -127,7 +127,7 @@ export default class LogoutDialog extends React.Component { this.props.onFinished(true); }; - render() { + public render() { if (this.state.shouldLoadBackupStatus) { const description = (
diff --git a/src/components/views/dialogs/MessageEditHistoryDialog.tsx b/src/components/views/dialogs/MessageEditHistoryDialog.tsx index f3e25fd9213..943e7f58d2d 100644 --- a/src/components/views/dialogs/MessageEditHistoryDialog.tsx +++ b/src/components/views/dialogs/MessageEditHistoryDialog.tsx @@ -48,7 +48,7 @@ interface IState { } export default class MessageEditHistoryDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { originalEvent: null, diff --git a/src/components/views/dialogs/ModalWidgetDialog.tsx b/src/components/views/dialogs/ModalWidgetDialog.tsx index 92a447532f1..a91f617cbb6 100644 --- a/src/components/views/dialogs/ModalWidgetDialog.tsx +++ b/src/components/views/dialogs/ModalWidgetDialog.tsx @@ -61,11 +61,11 @@ export default class ModalWidgetDialog extends React.PureComponent = React.createRef(); - state: IState = { + public state: IState = { disabledButtonIds: (this.props.widgetDefinition.buttons || []).filter((b) => b.disabled).map((b) => b.id), }; - constructor(props) { + public constructor(props) { super(props); this.widget = new ElementWidget({ diff --git a/src/components/views/dialogs/ReportEventDialog.tsx b/src/components/views/dialogs/ReportEventDialog.tsx index 3e4cde9d994..77640c27321 100644 --- a/src/components/views/dialogs/ReportEventDialog.tsx +++ b/src/components/views/dialogs/ReportEventDialog.tsx @@ -96,7 +96,7 @@ export default class ReportEventDialog extends React.Component { // If the room supports moderation, the moderation information. private moderation?: Moderation; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); let moderatedByRoomId = null; diff --git a/src/components/views/dialogs/RoomSettingsDialog.tsx b/src/components/views/dialogs/RoomSettingsDialog.tsx index 35519a2bec9..a10d54f4d0e 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.tsx +++ b/src/components/views/dialogs/RoomSettingsDialog.tsx @@ -55,7 +55,7 @@ interface IState { export default class RoomSettingsDialog extends React.Component { private dispatcherRef: string; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { roomName: "" }; } @@ -180,7 +180,7 @@ export default class RoomSettingsDialog extends React.Component return tabs; } - render() { + public render() { const roomName = this.state.roomName; return ( { private targetVersion: string; - state = { + public state = { busy: true, }; - async componentDidMount() { + public async componentDidMount() { const recommended = await this.props.room.getRecommendedVersion(); this.targetVersion = recommended.version; this.setState({ busy: false }); @@ -68,7 +68,7 @@ export default class RoomUpgradeDialog extends React.Component { }); }; - render() { + public render() { let buttons; if (this.state.busy) { buttons = ; diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx b/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx index 6f5391d8b76..0fd44dfbcf9 100644 --- a/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx +++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.tsx @@ -53,7 +53,7 @@ export default class RoomUpgradeWarningDialog extends React.Component(); private validatedConf: ValidatedServerConfig; - constructor(props) { + public constructor(props) { super(props); const config = SdkConfig.get(); diff --git a/src/components/views/dialogs/SeshatResetDialog.tsx b/src/components/views/dialogs/SeshatResetDialog.tsx index f075ae7b190..caa243c3405 100644 --- a/src/components/views/dialogs/SeshatResetDialog.tsx +++ b/src/components/views/dialogs/SeshatResetDialog.tsx @@ -22,7 +22,7 @@ import DialogButtons from "../elements/DialogButtons"; import { IDialogProps } from "./IDialogProps"; export default class SeshatResetDialog extends React.PureComponent { - render() { + public render() { return ( { private addThreepid: AddThreepid; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/ShareDialog.tsx b/src/components/views/dialogs/ShareDialog.tsx index 683e90a73bb..05e25a9d154 100644 --- a/src/components/views/dialogs/ShareDialog.tsx +++ b/src/components/views/dialogs/ShareDialog.tsx @@ -75,7 +75,7 @@ interface IState { } export default class ShareDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); let permalinkCreator: RoomPermalinkCreator = null; @@ -91,7 +91,7 @@ export default class ShareDialog extends React.PureComponent { }; } - static onLinkClick(e) { + public static onLinkClick(e) { e.preventDefault(); selectText(e.target); } @@ -124,7 +124,7 @@ export default class ShareDialog extends React.PureComponent { return matrixToUrl; } - render() { + public render() { let title; let checkbox; diff --git a/src/components/views/dialogs/TermsDialog.tsx b/src/components/views/dialogs/TermsDialog.tsx index e69587aef1b..078aaa10db0 100644 --- a/src/components/views/dialogs/TermsDialog.tsx +++ b/src/components/views/dialogs/TermsDialog.tsx @@ -33,7 +33,7 @@ class TermsCheckbox extends React.PureComponent { this.props.onChange(this.props.url, ev.currentTarget.checked); }; - render() { + public render() { return ; } } @@ -63,7 +63,7 @@ interface IState { } export default class TermsDialog extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { // url -> boolean diff --git a/src/components/views/dialogs/TextInputDialog.tsx b/src/components/views/dialogs/TextInputDialog.tsx index bf812a24f8f..da9a2c4f58e 100644 --- a/src/components/views/dialogs/TextInputDialog.tsx +++ b/src/components/views/dialogs/TextInputDialog.tsx @@ -54,7 +54,7 @@ export default class TextInputDialog extends React.Component { hasCancel: true, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/UploadConfirmDialog.tsx b/src/components/views/dialogs/UploadConfirmDialog.tsx index aeaf85bbbb7..309638e7868 100644 --- a/src/components/views/dialogs/UploadConfirmDialog.tsx +++ b/src/components/views/dialogs/UploadConfirmDialog.tsx @@ -35,11 +35,11 @@ export default class UploadConfirmDialog extends React.Component { private readonly objectUrl: string; private readonly mimeType: string; - static defaultProps = { + public static defaultProps = { totalFiles: 1, }; - constructor(props) { + public constructor(props) { super(props); // Create a fresh `Blob` for previewing (even though `File` already is @@ -49,7 +49,7 @@ export default class UploadConfirmDialog extends React.Component { this.objectUrl = URL.createObjectURL(blob); } - componentWillUnmount() { + public componentWillUnmount() { if (this.objectUrl) URL.revokeObjectURL(this.objectUrl); } @@ -65,7 +65,7 @@ export default class UploadConfirmDialog extends React.Component { this.props.onFinished(true, true); }; - render() { + public render() { let title: string; if (this.props.totalFiles > 1 && this.props.currentIndex !== undefined) { title = _t("Upload files (%(current)s of %(total)s)", { diff --git a/src/components/views/dialogs/UserSettingsDialog.tsx b/src/components/views/dialogs/UserSettingsDialog.tsx index c7b0de80ab6..6f1531e15d2 100644 --- a/src/components/views/dialogs/UserSettingsDialog.tsx +++ b/src/components/views/dialogs/UserSettingsDialog.tsx @@ -50,7 +50,7 @@ interface IState { export default class UserSettingsDialog extends React.Component { private settingsWatchers: string[] = []; - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -210,7 +210,7 @@ export default class UserSettingsDialog extends React.Component return tabs; } - render() { + public render() { return ( { - constructor(props) { + public constructor(props) { super(props); this.state = { verificationRequest: this.props.verificationRequest, @@ -47,7 +47,7 @@ export default class VerificationRequestDialog extends React.Component { private eventPermissionsMap = new Map(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); const parsedEvents = WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities); diff --git a/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx b/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx index 68c4342e8b1..f33e392443c 100644 --- a/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx +++ b/src/components/views/dialogs/WidgetOpenIDPermissionsDialog.tsx @@ -38,7 +38,7 @@ interface IState { } export default class WidgetOpenIDPermissionsDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx index 586ce4a6627..0461aba4082 100644 --- a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx +++ b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx @@ -62,7 +62,7 @@ interface IState { export default class AccessSecretStorageDialog extends React.PureComponent { private fileUpload = React.createRef(); - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -268,7 +268,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -167,7 +167,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent { - static defaultProps = { + public static defaultProps = { showSummary: true, }; - constructor(props) { + public constructor(props) { super(props); this.state = { backupInfo: null, diff --git a/src/components/views/dialogs/security/SetupEncryptionDialog.tsx b/src/components/views/dialogs/security/SetupEncryptionDialog.tsx index 0be95442610..01f2a7045c3 100644 --- a/src/components/views/dialogs/security/SetupEncryptionDialog.tsx +++ b/src/components/views/dialogs/security/SetupEncryptionDialog.tsx @@ -38,7 +38,7 @@ interface IState { export default class SetupEncryptionDialog extends React.Component { private store: SetupEncryptionStore; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.store = SetupEncryptionStore.sharedInstance(); diff --git a/src/components/views/elements/AccessibleTooltipButton.tsx b/src/components/views/elements/AccessibleTooltipButton.tsx index ce1d2ca69f6..4c4c7104650 100644 --- a/src/components/views/elements/AccessibleTooltipButton.tsx +++ b/src/components/views/elements/AccessibleTooltipButton.tsx @@ -36,14 +36,14 @@ interface IState { } export default class AccessibleTooltipButton extends React.PureComponent { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { hover: false, }; } - componentDidUpdate(prevProps: Readonly) { + public componentDidUpdate(prevProps: Readonly) { if (!prevProps.forceHide && this.props.forceHide && this.state.hover) { this.setState({ hover: false, @@ -73,7 +73,7 @@ export default class AccessibleTooltipButton extends React.PureComponent { - static defaultProps: Partial = { + public static defaultProps: Partial = { onPermissionGranted: () => {}, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // The first step is to pick apart the widget so we can render information about it @@ -88,7 +88,7 @@ export default class AppPermission extends React.Component { } } - render() { + public render() { const brand = SdkConfig.get().brand; const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId; diff --git a/src/components/views/elements/AppTile.tsx b/src/components/views/elements/AppTile.tsx index d9abe52e423..bb44a2940e3 100644 --- a/src/components/views/elements/AppTile.tsx +++ b/src/components/views/elements/AppTile.tsx @@ -104,7 +104,7 @@ interface IState { export default class AppTile extends React.Component { public static contextType = MatrixClientContext; - context: ContextType; + public context: ContextType; public static defaultProps: Partial = { waitForIframeLoad: true, @@ -126,7 +126,7 @@ export default class AppTile extends React.Component { private dispatcherRef: string; private unmounted: boolean; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // Tiles in miniMode are floating, and therefore not docked diff --git a/src/components/views/elements/DesktopCapturerSourcePicker.tsx b/src/components/views/elements/DesktopCapturerSourcePicker.tsx index c372eb2a368..c93701cd915 100644 --- a/src/components/views/elements/DesktopCapturerSourcePicker.tsx +++ b/src/components/views/elements/DesktopCapturerSourcePicker.tsx @@ -47,7 +47,7 @@ export interface ExistingSourceIProps { } export class ExistingSource extends React.Component { - constructor(props: ExistingSourceIProps) { + public constructor(props: ExistingSourceIProps) { super(props); } @@ -55,7 +55,7 @@ export class ExistingSource extends React.Component { this.props.onSelect(this.props.source); }; - render() { + public render() { const thumbnailClasses = classNames({ mx_desktopCapturerSourcePicker_source_thumbnail: true, mx_desktopCapturerSourcePicker_source_thumbnail_selected: this.props.selected, @@ -84,9 +84,9 @@ export interface PickerIProps { } export default class DesktopCapturerSourcePicker extends React.Component { - interval: number; + public interval: number; - constructor(props: PickerIProps) { + public constructor(props: PickerIProps) { super(props); this.state = { @@ -96,7 +96,7 @@ export default class DesktopCapturerSourcePicker extends React.Component{sources}
); } - render() { + public render() { const tabs = [ this.getTab("screen", _t("Share entire screen")), this.getTab("window", _t("Application window")), diff --git a/src/components/views/elements/DialPadBackspaceButton.tsx b/src/components/views/elements/DialPadBackspaceButton.tsx index 4e40cfa9060..d877cfde50d 100644 --- a/src/components/views/elements/DialPadBackspaceButton.tsx +++ b/src/components/views/elements/DialPadBackspaceButton.tsx @@ -25,7 +25,7 @@ interface IProps { } export default class DialPadBackspaceButton extends React.PureComponent { - render() { + public render() { return (
{ - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -73,7 +73,7 @@ export default class Draggable extends React.Component { }); } - render() { + public render() { return
; } } diff --git a/src/components/views/elements/Dropdown.tsx b/src/components/views/elements/Dropdown.tsx index 960c4387cdd..82348dd7934 100644 --- a/src/components/views/elements/Dropdown.tsx +++ b/src/components/views/elements/Dropdown.tsx @@ -35,7 +35,7 @@ interface IMenuOptionProps { } class MenuOption extends React.Component { - static defaultProps = { + public static defaultProps = { disabled: false, }; @@ -49,7 +49,7 @@ class MenuOption extends React.Component { this.props.onClick(this.props.dropdownKey); }; - render() { + public render() { const optClasses = classnames({ mx_Dropdown_option: true, mx_Dropdown_option_highlight: this.props.highlighted, @@ -117,7 +117,7 @@ export default class Dropdown extends React.Component { private ignoreEvent: MouseEvent = null; private childrenByKey: Record = {}; - constructor(props: DropdownProps) { + public constructor(props: DropdownProps) { super(props); this.reindexChildren(this.props.children); @@ -149,7 +149,7 @@ export default class Dropdown extends React.Component { } } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("click", this.onDocumentClick, false); } @@ -327,7 +327,7 @@ export default class Dropdown extends React.Component { return options; } - render() { + public render() { let currentValue; const menuStyle: CSSProperties = {}; diff --git a/src/components/views/elements/EditableItemList.tsx b/src/components/views/elements/EditableItemList.tsx index 140707dcf2b..40b1a62ab6e 100644 --- a/src/components/views/elements/EditableItemList.tsx +++ b/src/components/views/elements/EditableItemList.tsx @@ -57,7 +57,7 @@ export class EditableItem extends React.Component { this.setState({ verifyRemove: false }); }; - render() { + public render() { if (this.state.verifyRemove) { return (
@@ -148,7 +148,7 @@ export default class EditableItemList

extends React.PureComponent { if (!this.props.canRemove) { return

  • {item}
  • ; diff --git a/src/components/views/elements/EditableText.tsx b/src/components/views/elements/EditableText.tsx index b850a76a4a3..89d4220bca4 100644 --- a/src/components/views/elements/EditableText.tsx +++ b/src/components/views/elements/EditableText.tsx @@ -62,7 +62,7 @@ export default class EditableText extends React.Component { blurToSubmit: false, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/EditableTextContainer.tsx b/src/components/views/elements/EditableTextContainer.tsx index 1487ab45322..1468b24e54c 100644 --- a/src/components/views/elements/EditableTextContainer.tsx +++ b/src/components/views/elements/EditableTextContainer.tsx @@ -66,7 +66,7 @@ export default class EditableTextContainer extends React.Component { - constructor(props) { + public constructor(props) { super(props); this.state = { @@ -42,13 +42,13 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> { }; } - static getDerivedStateFromError(error: Error): Partial { + public static getDerivedStateFromError(error: Error): Partial { // Side effects are not permitted here, so we only update the state so // that the next render shows an error message. return { error }; } - componentDidCatch(error: Error, { componentStack }: ErrorInfo): void { + public componentDidCatch(error: Error, { componentStack }: ErrorInfo): void { // Browser consoles are better at formatting output when native errors are passed // in their own `console.error` invocation. logger.error(error); @@ -73,7 +73,7 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> { }); }; - render() { + public render() { if (this.state.error) { const newIssueUrl = "https://github.com/vector-im/element-web/issues/new/choose"; diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index 715f08ad57e..7294059baea 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -79,17 +79,17 @@ enum TransitionType { const SEP = ","; export default class EventListSummary extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; - static defaultProps = { + public static defaultProps = { summaryLength: 1, threshold: 3, avatarsMaxLength: 5, layout: Layout.Group, }; - shouldComponentUpdate(nextProps: IProps): boolean { + public shouldComponentUpdate(nextProps: IProps): boolean { // Update if // - The number of summarised events has changed // - or if the summary is about to toggle to become collapsed @@ -451,7 +451,7 @@ export default class EventListSummary extends React.Component { } } - getAggregate(userEvents: Record) { + public getAggregate(userEvents: Record) { // A map of aggregate type to arrays of display names. Each aggregate type // is a comma-delimited string of transitions, e.g. "joined,left,kicked". // The array of display names is the array of users who went through that @@ -489,7 +489,7 @@ export default class EventListSummary extends React.Component { }; } - render() { + public render() { const eventsToRender = this.props.events; // Map user IDs to latest Avatar Member. ES6 Maps are ordered by when the key was created, diff --git a/src/components/views/elements/EventTilePreview.tsx b/src/components/views/elements/EventTilePreview.tsx index a492a60e8d4..828680b870d 100644 --- a/src/components/views/elements/EventTilePreview.tsx +++ b/src/components/views/elements/EventTilePreview.tsx @@ -63,7 +63,7 @@ interface IState { const AVATAR_SIZE = 32; export default class EventTilePreview extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { message: props.message, diff --git a/src/components/views/elements/Field.tsx b/src/components/views/elements/Field.tsx index 1a43003232f..31a6e88897c 100644 --- a/src/components/views/elements/Field.tsx +++ b/src/components/views/elements/Field.tsx @@ -145,7 +145,7 @@ export default class Field extends React.PureComponent { }); }, VALIDATION_THROTTLE_MS); - constructor(props) { + public constructor(props) { super(props); this.state = { valid: undefined, diff --git a/src/components/views/elements/IRCTimelineProfileResizer.tsx b/src/components/views/elements/IRCTimelineProfileResizer.tsx index 8eb87837a7c..5c941be955d 100644 --- a/src/components/views/elements/IRCTimelineProfileResizer.tsx +++ b/src/components/views/elements/IRCTimelineProfileResizer.tsx @@ -33,7 +33,7 @@ interface IState { } export default class IRCTimelineProfileResizer extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -42,7 +42,7 @@ export default class IRCTimelineProfileResizer extends React.Component; } } diff --git a/src/components/views/elements/ImageView.tsx b/src/components/views/elements/ImageView.tsx index 227082cea86..4c8e6e5bcd0 100644 --- a/src/components/views/elements/ImageView.tsx +++ b/src/components/views/elements/ImageView.tsx @@ -91,7 +91,7 @@ interface IState { } export default class ImageView extends React.Component { - constructor(props) { + public constructor(props) { super(props); const { thumbnailInfo } = this.props; @@ -126,7 +126,7 @@ export default class ImageView extends React.Component { private animatingLoading = false; private imageIsLoaded = false; - componentDidMount() { + public componentDidMount() { // We have to use addEventListener() because the listener // needs to be passive in order to work with Chromium this.focusLock.current.addEventListener("wheel", this.onWheel, { passive: false }); @@ -136,7 +136,7 @@ export default class ImageView extends React.Component { this.image.current.addEventListener("load", this.imageLoaded); } - componentWillUnmount() { + public componentWillUnmount() { this.focusLock.current.removeEventListener("wheel", this.onWheel); window.removeEventListener("resize", this.recalculateZoom); this.image.current.removeEventListener("load", this.imageLoaded); @@ -411,7 +411,7 @@ export default class ImageView extends React.Component { return {contextMenu}; } - render() { + public render() { const showEventMeta = !!this.props.mxEvent; let transitionClassName; diff --git a/src/components/views/elements/InfoTooltip.tsx b/src/components/views/elements/InfoTooltip.tsx index 3808b249a3e..818781bff46 100644 --- a/src/components/views/elements/InfoTooltip.tsx +++ b/src/components/views/elements/InfoTooltip.tsx @@ -35,11 +35,11 @@ interface ITooltipProps { } export default class InfoTooltip extends React.PureComponent { - constructor(props: ITooltipProps) { + public constructor(props: ITooltipProps) { super(props); } - render() { + public render() { const { tooltip, children, tooltipClassName, className, kind } = this.props; const title = _t("Information"); const iconClassName = diff --git a/src/components/views/elements/InlineSpinner.tsx b/src/components/views/elements/InlineSpinner.tsx index a3f31def285..398144a5be9 100644 --- a/src/components/views/elements/InlineSpinner.tsx +++ b/src/components/views/elements/InlineSpinner.tsx @@ -25,12 +25,12 @@ interface IProps { } export default class InlineSpinner extends React.PureComponent { - static defaultProps = { + public static defaultProps = { w: 16, h: 16, }; - render() { + public render() { return (
    side: Direction.Top, }; - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -317,7 +317,7 @@ export default class InteractiveTooltip extends React.Component }; } - componentDidUpdate() { + public componentDidUpdate() { // Whenever this passthrough component updates, also render the tooltip // in a separate DOM tree. This allows the tooltip content to participate // the normal React rendering cycle: when this component re-renders, the @@ -327,7 +327,7 @@ export default class InteractiveTooltip extends React.Component this.renderTooltip(); } - componentWillUnmount() { + public componentWillUnmount() { document.removeEventListener("mousemove", this.onMouseMove); } @@ -486,7 +486,7 @@ export default class InteractiveTooltip extends React.Component ReactDOM.render(tooltip, getOrCreateContainer()); } - render() { + public render() { return this.props.children({ ref: this.collectTarget, onMouseOver: this.onTargetMouseOver, diff --git a/src/components/views/elements/InviteReason.tsx b/src/components/views/elements/InviteReason.tsx index c3f676786f3..5307bfc9405 100644 --- a/src/components/views/elements/InviteReason.tsx +++ b/src/components/views/elements/InviteReason.tsx @@ -30,7 +30,7 @@ interface IState { } export default class InviteReason extends React.PureComponent { - constructor(props) { + public constructor(props) { super(props); this.state = { // We hide the reason for invitation by default, since it can be a @@ -39,13 +39,13 @@ export default class InviteReason extends React.PureComponent { }; } - onViewClick = () => { + public onViewClick = () => { this.setState({ hidden: false, }); }; - render() { + public render() { const classes = classNames({ mx_InviteReason: true, mx_InviteReason_hidden: this.state.hidden, diff --git a/src/components/views/elements/LanguageDropdown.tsx b/src/components/views/elements/LanguageDropdown.tsx index 7023fcaeafa..35697c53e47 100644 --- a/src/components/views/elements/LanguageDropdown.tsx +++ b/src/components/views/elements/LanguageDropdown.tsx @@ -42,7 +42,7 @@ interface IState { } export default class LanguageDropdown extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/LazyRenderList.tsx b/src/components/views/elements/LazyRenderList.tsx index 71071c87097..492cff95c94 100644 --- a/src/components/views/elements/LazyRenderList.tsx +++ b/src/components/views/elements/LazyRenderList.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; class ItemRange { - constructor(public topCount: number, public renderCount: number, public bottomCount: number) {} + public constructor(public topCount: number, public renderCount: number, public bottomCount: number) {} public contains(range: ItemRange): boolean { // don't contain empty ranges @@ -85,7 +85,7 @@ export default class LazyRenderList extends React.Component, overflowMargin: 5, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/LinkWithTooltip.tsx b/src/components/views/elements/LinkWithTooltip.tsx index dd14eb505ac..d682f34e460 100644 --- a/src/components/views/elements/LinkWithTooltip.tsx +++ b/src/components/views/elements/LinkWithTooltip.tsx @@ -21,7 +21,7 @@ import TextWithTooltip from "./TextWithTooltip"; interface IProps extends Omit, "tabIndex" | "onClick"> {} export default class LinkWithTooltip extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/elements/Measured.tsx b/src/components/views/elements/Measured.tsx index 903cec79210..1c271505104 100644 --- a/src/components/views/elements/Measured.tsx +++ b/src/components/views/elements/Measured.tsx @@ -28,21 +28,21 @@ export default class Measured extends React.PureComponent { private static instanceCount = 0; private readonly instanceId: number; - static defaultProps = { + public static defaultProps = { breakpoint: 500, }; - constructor(props) { + public constructor(props) { super(props); this.instanceId = Measured.instanceCount++; } - componentDidMount() { + public componentDidMount() { UIStore.instance.on(`Measured${this.instanceId}`, this.onResize); } - componentDidUpdate(prevProps: Readonly) { + public componentDidUpdate(prevProps: Readonly) { const previous = prevProps.sensor; const current = this.props.sensor; if (previous === current) return; @@ -54,7 +54,7 @@ export default class Measured extends React.PureComponent { } } - componentWillUnmount() { + public componentWillUnmount() { UIStore.instance.off(`Measured${this.instanceId}`, this.onResize); UIStore.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`); } @@ -64,7 +64,7 @@ export default class Measured extends React.PureComponent { this.props.onMeasurement(entry.contentRect.width <= this.props.breakpoint); }; - render() { + public render() { return null; } } diff --git a/src/components/views/elements/PersistedElement.tsx b/src/components/views/elements/PersistedElement.tsx index e1613e57c05..cfe5f24f96c 100644 --- a/src/components/views/elements/PersistedElement.tsx +++ b/src/components/views/elements/PersistedElement.tsx @@ -78,7 +78,7 @@ export default class PersistedElement extends React.Component { private childContainer: HTMLDivElement; private child: HTMLDivElement; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.resizeObserver = new ResizeObserver(this.repositionChild); @@ -107,7 +107,7 @@ export default class PersistedElement extends React.Component { } } - static isMounted(persistKey) { + public static isMounted(persistKey) { return Boolean(getContainer("mx_persistedElement_" + persistKey)); } diff --git a/src/components/views/elements/PersistentApp.tsx b/src/components/views/elements/PersistentApp.tsx index 3a85b32d449..fc24b2b8c68 100644 --- a/src/components/views/elements/PersistentApp.tsx +++ b/src/components/views/elements/PersistentApp.tsx @@ -32,10 +32,10 @@ interface IProps { export default class PersistentApp extends React.Component { public static contextType = MatrixClientContext; - context: ContextType; + public context: ContextType; private room: Room; - constructor(props: IProps, context: ContextType) { + public constructor(props: IProps, context: ContextType) { super(props, context); this.room = context.getRoom(this.props.persistentRoomId)!; } diff --git a/src/components/views/elements/Pill.tsx b/src/components/views/elements/Pill.tsx index 3c18cb1b3e8..8107560c054 100644 --- a/src/components/views/elements/Pill.tsx +++ b/src/components/views/elements/Pill.tsx @@ -75,7 +75,7 @@ export default class Pill extends React.Component { return "@room".length; } - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/PollCreateDialog.tsx b/src/components/views/elements/PollCreateDialog.tsx index 3889fa1f1f5..3d987c3d966 100644 --- a/src/components/views/elements/PollCreateDialog.tsx +++ b/src/components/views/elements/PollCreateDialog.tsx @@ -256,7 +256,7 @@ export default class PollCreateDialog extends ScrollableBaseModal) => { + public onPollTypeChange = (e: ChangeEvent) => { this.setState({ kind: M_POLL_KIND_DISCLOSED.matches(e.target.value) ? M_POLL_KIND_DISCLOSED : M_POLL_KIND_UNDISCLOSED, }); diff --git a/src/components/views/elements/PowerSelector.tsx b/src/components/views/elements/PowerSelector.tsx index c6b42462ef4..74fc35be9e0 100644 --- a/src/components/views/elements/PowerSelector.tsx +++ b/src/components/views/elements/PowerSelector.tsx @@ -60,7 +60,7 @@ export default class PowerSelector extends React.Component { usersDefault: 0, }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/ReplyChain.tsx b/src/components/views/elements/ReplyChain.tsx index 9168426fbff..f0b6f48b7a5 100644 --- a/src/components/views/elements/ReplyChain.tsx +++ b/src/components/views/elements/ReplyChain.tsx @@ -74,14 +74,14 @@ interface IState { // craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would // be low as each event being loaded (after the first) is triggered by an explicit user action. export default class ReplyChain extends React.Component { - static contextType = RoomContext; + public static contextType = RoomContext; public context!: React.ContextType; private unmounted = false; private room: Room; private blockquoteRef = React.createRef(); - constructor(props: IProps, context: React.ContextType) { + public constructor(props: IProps, context: React.ContextType) { super(props, context); this.state = { @@ -98,17 +98,17 @@ export default class ReplyChain extends React.Component { return MatrixClientPeg.get(); } - componentDidMount() { + public componentDidMount() { this.initialize(); this.trySetExpandableQuotes(); } - componentDidUpdate() { + public componentDidUpdate() { this.props.onHeightChanged(); this.trySetExpandableQuotes(); } - componentWillUnmount() { + public componentWillUnmount() { this.unmounted = true; } @@ -199,7 +199,7 @@ export default class ReplyChain extends React.Component { return getUserNameColorClass(ev.getSender()).replace("Username", "ReplyChain"); } - render() { + public render() { let header = null; if (this.state.err) { header = ( diff --git a/src/components/views/elements/RoomAliasField.tsx b/src/components/views/elements/RoomAliasField.tsx index e31daf32aac..d894fb1e0db 100644 --- a/src/components/views/elements/RoomAliasField.tsx +++ b/src/components/views/elements/RoomAliasField.tsx @@ -39,12 +39,12 @@ interface IState { // Controlled form component wrapping Field for inputting a room alias scoped to a given domain export default class RoomAliasField extends React.PureComponent { - static contextType = MatrixClientContext; + public static contextType = MatrixClientContext; public context!: React.ContextType; private fieldRef = createRef(); - constructor(props, context) { + public constructor(props, context) { super(props, context); this.state = { @@ -72,7 +72,7 @@ export default class RoomAliasField extends React.PureComponent return { prefix, postfix, value, maxlength }; } - render() { + public render() { const { prefix, postfix, value, maxlength } = this.domainProps; return ( { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { diff --git a/src/components/views/elements/Slider.tsx b/src/components/views/elements/Slider.tsx index 0e1a0b32a49..ab34e114ba5 100644 --- a/src/components/views/elements/Slider.tsx +++ b/src/components/views/elements/Slider.tsx @@ -70,7 +70,7 @@ export default class Slider extends React.Component { return 100 * (closest - 1 + linearInterpolation) * intervalWidth; } - render(): React.ReactNode { + public render(): React.ReactNode { const dots = this.props.values.map((v) => ( { ); } - onClick(event: React.MouseEvent) { + public onClick(event: React.MouseEvent) { const width = (event.target as HTMLElement).clientWidth; // nativeEvent is safe to use because https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX // is supported by all modern browsers @@ -133,7 +133,7 @@ interface IDotProps { } class Dot extends React.PureComponent { - render(): React.ReactNode { + public render(): React.ReactNode { let className = "mx_Slider_dot"; if (!this.props.disabled && this.props.active) { className += " mx_Slider_dotActive"; diff --git a/src/components/views/elements/SpellCheckLanguagesDropdown.tsx b/src/components/views/elements/SpellCheckLanguagesDropdown.tsx index e9f75da21eb..026b7e3409c 100644 --- a/src/components/views/elements/SpellCheckLanguagesDropdown.tsx +++ b/src/components/views/elements/SpellCheckLanguagesDropdown.tsx @@ -43,7 +43,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< SpellCheckLanguagesDropdownIProps, SpellCheckLanguagesDropdownIState > { - constructor(props) { + public constructor(props) { super(props); this.onSearchChange = this.onSearchChange.bind(this); @@ -53,7 +53,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< }; } - componentDidMount() { + public componentDidMount() { const plaf = PlatformPeg.get(); if (plaf) { plaf.getAvailableSpellCheckLanguages() @@ -82,7 +82,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component< this.setState({ searchQuery }); } - render() { + public render() { if (this.state.languages === null) { return ; } diff --git a/src/components/views/elements/Spoiler.tsx b/src/components/views/elements/Spoiler.tsx index cb41ddef22a..839272451bd 100644 --- a/src/components/views/elements/Spoiler.tsx +++ b/src/components/views/elements/Spoiler.tsx @@ -26,7 +26,7 @@ interface IState { } export default class Spoiler extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { visible: false, diff --git a/src/components/views/elements/StyledCheckbox.tsx b/src/components/views/elements/StyledCheckbox.tsx index 33328275cb8..56ba1faefef 100644 --- a/src/components/views/elements/StyledCheckbox.tsx +++ b/src/components/views/elements/StyledCheckbox.tsx @@ -38,7 +38,7 @@ export default class StyledCheckbox extends React.PureComponent className: "", }; - constructor(props: IProps) { + public constructor(props: IProps) { super(props); // 56^10 so unlikely chance of collision. this.id = this.props.id || "checkbox_" + randomString(10); diff --git a/src/components/views/elements/TextWithTooltip.tsx b/src/components/views/elements/TextWithTooltip.tsx index bbcbcd58a57..f009f8c5267 100644 --- a/src/components/views/elements/TextWithTooltip.tsx +++ b/src/components/views/elements/TextWithTooltip.tsx @@ -28,7 +28,7 @@ interface IProps extends HTMLAttributes { } export default class TextWithTooltip extends React.Component { - constructor(props: IProps) { + public constructor(props: IProps) { super(props); } diff --git a/src/components/views/elements/Tooltip.tsx b/src/components/views/elements/Tooltip.tsx index c08983def46..1bb9ab66bf5 100644 --- a/src/components/views/elements/Tooltip.tsx +++ b/src/components/views/elements/Tooltip.tsx @@ -68,7 +68,7 @@ export default class Tooltip extends React.PureComponent { alignment: Alignment.Natural, }; - constructor(props) { + public constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/elements/TooltipButton.tsx b/src/components/views/elements/TooltipButton.tsx index 7fdaabd8fe9..1c5fb08bf2c 100644 --- a/src/components/views/elements/TooltipButton.tsx +++ b/src/components/views/elements/TooltipButton.tsx @@ -24,11 +24,11 @@ interface IProps { } export default class TooltipButton extends React.Component { - constructor(props) { + public constructor(props) { super(props); } - render() { + public render() { return ( { - static defaultProps = { + public static defaultProps = { truncateAt: 2, createOverflowElement(overflowCount, totalCount) { return
    {_t("And %(count)s more...", { count: overflowCount })}
    ; diff --git a/src/components/views/emojipicker/Category.tsx b/src/components/views/emojipicker/Category.tsx index 6157d366f01..8ecbd6e9132 100644 --- a/src/components/views/emojipicker/Category.tsx +++ b/src/components/views/emojipicker/Category.tsx @@ -69,7 +69,7 @@ class Category extends React.PureComponent { ); }; - render() { + public render() { const { emojis, name, heightBefore, viewportHeight, scrollTop } = this.props; if (!emojis || emojis.length === 0) { return null; diff --git a/src/components/views/emojipicker/Emoji.tsx b/src/components/views/emojipicker/Emoji.tsx index 19cdc051267..7ae00ae50dc 100644 --- a/src/components/views/emojipicker/Emoji.tsx +++ b/src/components/views/emojipicker/Emoji.tsx @@ -30,7 +30,7 @@ interface IProps { } class Emoji extends React.PureComponent { - render() { + public render() { const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props; const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode); return ( diff --git a/src/components/views/emojipicker/EmojiPicker.tsx b/src/components/views/emojipicker/EmojiPicker.tsx index 76857012c4e..320f0f185e8 100644 --- a/src/components/views/emojipicker/EmojiPicker.tsx +++ b/src/components/views/emojipicker/EmojiPicker.tsx @@ -57,7 +57,7 @@ class EmojiPicker extends React.Component { private scrollRef = React.createRef>(); - constructor(props: IProps) { + public constructor(props: IProps) { super(props); this.state = { @@ -249,7 +249,7 @@ class EmojiPicker extends React.Component { return CATEGORY_HEADER_HEIGHT + Math.ceil(count / EMOJIS_PER_ROW) * EMOJI_HEIGHT; } - render() { + public render() { let heightBefore = 0; return (
    diff --git a/src/components/views/emojipicker/Header.tsx b/src/components/views/emojipicker/Header.tsx index a203397eea2..83c0eeb932b 100644 --- a/src/components/views/emojipicker/Header.tsx +++ b/src/components/views/emojipicker/Header.tsx @@ -82,7 +82,7 @@ class Header extends React.PureComponent { } }; - render() { + public render() { return (