Enable @typescript-eslint/explicit-member-accessibility on /src (#9785)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier
This commit is contained in:
Michael Telatynski 2022-12-16 12:29:59 +00:00 committed by GitHub
parent 51554399fb
commit f1e8e7f140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
396 changed files with 1110 additions and 1098 deletions

View file

@ -102,7 +102,6 @@ module.exports = {
rules: { rules: {
// temporary disabled // temporary disabled
"@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
// Things we do that break the ideal style // Things we do that break the ideal style
"prefer-promise-reject-errors": "off", "prefer-promise-reject-errors": "off",
@ -157,6 +156,14 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off", "@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: { settings: {
react: { react: {

View file

@ -48,7 +48,7 @@ export function polyfillTouchEvent() {
public get scale(): number { public get scale(): number {
return 0.0; return 0.0;
} }
constructor(eventType: string, params?: any) { public constructor(eventType: string, params?: any) {
super(eventType, params); super(eventType, params);
} }
}; };

View file

@ -16,7 +16,7 @@ limitations under the License.
declare module "*.worker.ts" { declare module "*.worker.ts" {
class WebpackWorker extends Worker { class WebpackWorker extends Worker {
constructor(); public constructor();
} }
export default WebpackWorker; export default WebpackWorker;

View file

@ -47,7 +47,7 @@ export default class AddThreepid {
private clientSecret: string; private clientSecret: string;
private bind: boolean; private bind: boolean;
constructor() { public constructor() {
this.clientSecret = MatrixClientPeg.get().generateClientSecret(); this.clientSecret = MatrixClientPeg.get().generateClientSecret();
} }

View file

@ -47,7 +47,7 @@ export default class AsyncWrapper extends React.Component<IProps, IState> {
error: null, error: null,
}; };
componentDidMount() { public componentDidMount() {
// XXX: temporary logging to try to diagnose // XXX: temporary logging to try to diagnose
// https://github.com/vector-im/element-web/issues/3148 // https://github.com/vector-im/element-web/issues/3148
logger.log("Starting load of AsyncWrapper for modal"); logger.log("Starting load of AsyncWrapper for modal");
@ -69,7 +69,7 @@ export default class AsyncWrapper extends React.Component<IProps, IState> {
}); });
} }
componentWillUnmount() { public componentWillUnmount() {
this.unmounted = true; this.unmounted = true;
} }
@ -77,7 +77,7 @@ export default class AsyncWrapper extends React.Component<IProps, IState> {
this.props.onFinished(false); this.props.onFinished(false);
}; };
render() { public render() {
if (this.state.component) { if (this.state.component) {
const Component = this.state.component; const Component = this.state.component;
return <Component {...this.props} />; return <Component {...this.props} />;

View file

@ -69,7 +69,7 @@ export default abstract class BasePlatform {
protected notificationCount = 0; protected notificationCount = 0;
protected errorDidOccur = false; protected errorDidOccur = false;
constructor() { public constructor() {
dis.register(this.onAction); dis.register(this.onAction);
this.startUpdateCheck = this.startUpdateCheck.bind(this); this.startUpdateCheck = this.startUpdateCheck.bind(this);
} }

View file

@ -35,7 +35,7 @@ export class BlurhashEncoder {
private seq = 0; private seq = 0;
private pendingDeferredMap = new Map<number, IDeferred<string>>(); private pendingDeferredMap = new Map<number, IDeferred<string>>();
constructor() { public constructor() {
this.worker = new BlurhashWorker(); this.worker = new BlurhashWorker();
this.worker.onmessage = this.onMessage; this.worker.onmessage = this.onMessage;
} }

View file

@ -598,7 +598,7 @@ export default class ContentMessages {
}); });
} }
static sharedInstance() { public static sharedInstance() {
if (window.mxContentMessages === undefined) { if (window.mxContentMessages === undefined) {
window.mxContentMessages = new ContentMessages(); window.mxContentMessages = new ContentMessages();
} }

View file

@ -23,7 +23,7 @@ import { PosthogAnalytics } from "./PosthogAnalytics";
export class DecryptionFailure { export class DecryptionFailure {
public readonly ts: number; 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(); this.ts = Date.now();
} }
} }
@ -87,14 +87,14 @@ export class DecryptionFailureTracker {
public trackInterval: number = null; public trackInterval: number = null;
// Spread the load on `Analytics` by tracking at a low frequency, `TRACK_INTERVAL_MS`. // 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`. // 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 // Give events a chance to be decrypted by waiting `GRACE_PERIOD_MS` before counting
// the failure in `failureCounts`. // the failure in `failureCounts`.
static GRACE_PERIOD_MS = 4000; public static GRACE_PERIOD_MS = 4000;
/** /**
* Create a new DecryptionFailureTracker. * Create a new DecryptionFailureTracker.

View file

@ -354,7 +354,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = {
}; };
abstract class BaseHighlighter<T extends React.ReactNode> { abstract class BaseHighlighter<T extends React.ReactNode> {
constructor(public highlightClass: string, public highlightLink: string) {} public constructor(public highlightClass: string, public highlightLink: string) {}
/** /**
* apply the highlights to a section of text * apply the highlights to a section of text

View file

@ -44,7 +44,7 @@ export default class IdentityAuthClient {
* When provided, this class will operate solely within memory, refusing to * When provided, this class will operate solely within memory, refusing to
* persist any information such as tokens. Default null (not provided). * persist any information such as tokens. Default null (not provided).
*/ */
constructor(identityUrl?: string) { public constructor(identityUrl?: string) {
if (identityUrl) { if (identityUrl) {
// XXX: We shouldn't have to create a whole new MatrixClient just to // 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 // do identity server auth. The functions don't take an identity URL

View file

@ -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 * To overwrite the default key bindings add a new providers before the default provider, e.g. a provider for
* customized key bindings. * customized key bindings.
*/ */
bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider]; public bindingsProviders: IKeyBindingsProvider[] = [defaultBindingsProvider];
/** /**
* Finds a matching KeyAction for a given KeyboardEvent * Finds a matching KeyAction for a given KeyboardEvent
@ -124,56 +124,56 @@ export class KeyBindingsManager {
return undefined; return undefined;
} }
getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getMessageComposerBindings), this.bindingsProviders.map((it) => it.getMessageComposerBindings),
ev, ev,
); );
} }
getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getAutocompleteBindings), this.bindingsProviders.map((it) => it.getAutocompleteBindings),
ev, ev,
); );
} }
getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getRoomListBindings), this.bindingsProviders.map((it) => it.getRoomListBindings),
ev, ev,
); );
} }
getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getRoomBindings), this.bindingsProviders.map((it) => it.getRoomBindings),
ev, ev,
); );
} }
getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getNavigationBindings), this.bindingsProviders.map((it) => it.getNavigationBindings),
ev, ev,
); );
} }
getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getAccessibilityAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getAccessibilityBindings), this.bindingsProviders.map((it) => it.getAccessibilityBindings),
ev, ev,
); );
} }
getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getCallAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getCallBindings), this.bindingsProviders.map((it) => it.getCallBindings),
ev, ev,
); );
} }
getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined { public getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): KeyBindingAction | undefined {
return this.getAction( return this.getAction(
this.bindingsProviders.map((it) => it.getLabsBindings), this.bindingsProviders.map((it) => it.getLabsBindings),
ev, ev,

View file

@ -37,7 +37,7 @@ export default class Login {
private defaultDeviceDisplayName: string; private defaultDeviceDisplayName: string;
private tempClient: MatrixClient; 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.hsUrl = hsUrl;
this.isUrl = isUrl; this.isUrl = isUrl;
this.fallbackHsUrl = fallbackHsUrl; this.fallbackHsUrl = fallbackHsUrl;

View file

@ -117,7 +117,7 @@ export default class Markdown {
private input: string; private input: string;
private parsed: commonmark.Node; private parsed: commonmark.Node;
constructor(input: string) { public constructor(input: string) {
this.input = input; this.input = input;
const parser = new commonmark.Parser(); const parser = new commonmark.Parser();
@ -234,7 +234,7 @@ export default class Markdown {
return parsed; return parsed;
} }
isPlainText(): boolean { public isPlainText(): boolean {
const walker = this.parsed.walker(); const walker = this.parsed.walker();
let ev: commonmark.NodeWalkingStep; let ev: commonmark.NodeWalkingStep;
@ -257,7 +257,7 @@ export default class Markdown {
return true; return true;
} }
toHTML({ externalLinks = false } = {}): string { public toHTML({ externalLinks = false } = {}): string {
const renderer = new commonmark.HtmlRenderer({ const renderer = new commonmark.HtmlRenderer({
safe: false, safe: false,
@ -344,7 +344,7 @@ export default class Markdown {
* N.B. this does **NOT** render arbitrary MD to plain text - only MD * N.B. this does **NOT** render arbitrary MD to plain text - only MD
* which has no formatting. Otherwise it emits HTML(!). * which has no formatting. Otherwise it emits HTML(!).
*/ */
toPlaintext(): string { public toPlaintext(): string {
const renderer = new commonmark.HtmlRenderer({ safe: false }); const renderer = new commonmark.HtmlRenderer({ safe: false });
renderer.paragraph = function (node: commonmark.Node, entering: boolean) { renderer.paragraph = function (node: commonmark.Node, entering: boolean) {

View file

@ -47,7 +47,7 @@ export default class NodeAnimator extends React.Component<IProps> {
startStyles: [], startStyles: [],
}; };
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.updateChildren(this.props.children); this.updateChildren(this.props.children);

View file

@ -39,7 +39,7 @@ export default class PasswordReset {
* @param {string} homeserverUrl The URL to the HS which has the account to reset. * @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. * @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({ this.client = createClient({
baseUrl: homeserverUrl, baseUrl: homeserverUrl,
idBaseUrl: identityUrl, idBaseUrl: identityUrl,

View file

@ -146,7 +146,7 @@ export class PosthogAnalytics {
return this._instance; return this._instance;
} }
constructor(private readonly posthog: PostHog) { public constructor(private readonly posthog: PostHog) {
const posthogConfig = SdkConfig.getObject("posthog"); const posthogConfig = SdkConfig.getObject("posthog");
if (posthogConfig) { if (posthogConfig) {
this.posthog.init(posthogConfig.get("project_api_key"), { this.posthog.init(posthogConfig.get("project_api_key"), {

View file

@ -107,20 +107,20 @@ export default class PosthogTrackers {
} }
export class PosthogScreenTracker extends PureComponent<{ screenName: ScreenName }> { export class PosthogScreenTracker extends PureComponent<{ screenName: ScreenName }> {
componentDidMount() { public componentDidMount() {
PosthogTrackers.instance.trackOverride(this.props.screenName); 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 // 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); PosthogTrackers.instance.trackOverride(this.props.screenName);
} }
componentWillUnmount() { public componentWillUnmount() {
PosthogTrackers.instance.clearOverride(this.props.screenName); 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 return null; // no need to render anything, we just need to hook into the React lifecycle
} }
} }

View file

@ -36,7 +36,7 @@ export default class ScalarAuthClient {
private termsInteractionCallback: TermsInteractionCallback; private termsInteractionCallback: TermsInteractionCallback;
private isDefaultManager: boolean; private isDefaultManager: boolean;
constructor(private apiUrl: string, private uiUrl: string) { public constructor(private apiUrl: string, private uiUrl: string) {
this.scalarToken = null; this.scalarToken = null;
// `undefined` to allow `startTermsFlow` to fallback to a default // `undefined` to allow `startTermsFlow` to fallback to a default
// callback if this is unset. // callback if this is unset.
@ -72,22 +72,22 @@ export default class ScalarAuthClient {
return this.readTokenFromStore(); return this.readTokenFromStore();
} }
setTermsInteractionCallback(callback) { public setTermsInteractionCallback(callback) {
this.termsInteractionCallback = callback; this.termsInteractionCallback = callback;
} }
connect(): Promise<void> { public connect(): Promise<void> {
return this.getScalarToken().then((tok) => { return this.getScalarToken().then((tok) => {
this.scalarToken = tok; this.scalarToken = tok;
}); });
} }
hasCredentials(): boolean { public hasCredentials(): boolean {
return this.scalarToken != null; // undef or null return this.scalarToken != null; // undef or null
} }
// Returns a promise that resolves to a scalar_token string // Returns a promise that resolves to a scalar_token string
getScalarToken(): Promise<string> { public getScalarToken(): Promise<string> {
const token = this.readToken(); const token = this.readToken();
if (!token) { if (!token) {
@ -169,7 +169,7 @@ export default class ScalarAuthClient {
}); });
} }
registerForToken(): Promise<string> { public registerForToken(): Promise<string> {
// Get openid bearer token from the HS as the first part of our dance // Get openid bearer token from the HS as the first part of our dance
return MatrixClientPeg.get() return MatrixClientPeg.get()
.getOpenIdToken() .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 roomId = room.roomId;
const roomName = room.name; const roomName = room.name;
let url = this.uiUrl; let url = this.uiUrl;
@ -273,7 +273,7 @@ export default class ScalarAuthClient {
return url; return url;
} }
getStarterLink(starterLinkUrl: string): string { public getStarterLink(starterLinkUrl: string): string {
return starterLinkUrl + "?scalar_token=" + encodeURIComponent(this.scalarToken); return starterLinkUrl + "?scalar_token=" + encodeURIComponent(this.scalarToken);
} }
} }

View file

@ -67,7 +67,7 @@ export function isSecretStorageBeingAccessed(): boolean {
} }
export class AccessCancelledError extends Error { export class AccessCancelledError extends Error {
constructor() { public constructor() {
super("Secret storage access canceled"); super("Secret storage access canceled");
} }
} }

View file

@ -27,12 +27,12 @@ interface IHistoryItem {
} }
export default class SendHistoryManager { export default class SendHistoryManager {
history: Array<IHistoryItem> = []; public history: Array<IHistoryItem> = [];
prefix: string; public prefix: string;
lastIndex = 0; // used for indexing the storage public lastIndex = 0; // used for indexing the storage
currentIndex = 0; // used for indexing the loaded validated history Array 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; this.prefix = prefix + roomId;
// TODO: Performance issues? // TODO: Performance issues?
@ -53,14 +53,14 @@ export default class SendHistoryManager {
this.currentIndex = this.lastIndex + 1; this.currentIndex = this.lastIndex + 1;
} }
static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem { public static createItem(model: EditorModel, replyEvent?: MatrixEvent): IHistoryItem {
return { return {
parts: model.serializeParts(), parts: model.serializeParts(),
replyEventId: replyEvent ? replyEvent.getId() : undefined, replyEventId: replyEvent ? replyEvent.getId() : undefined,
}; };
} }
save(editorModel: EditorModel, replyEvent?: MatrixEvent) { public save(editorModel: EditorModel, replyEvent?: MatrixEvent) {
const item = SendHistoryManager.createItem(editorModel, replyEvent); const item = SendHistoryManager.createItem(editorModel, replyEvent);
this.history.push(item); this.history.push(item);
this.currentIndex = this.history.length; this.currentIndex = this.history.length;
@ -68,7 +68,7 @@ export default class SendHistoryManager {
sessionStorage.setItem(`${this.prefix}[${this.lastIndex}]`, JSON.stringify(item)); 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); this.currentIndex = clamp(this.currentIndex + offset, 0, this.history.length - 1);
return this.history[this.currentIndex]; return this.history[this.currentIndex];
} }

View file

@ -138,7 +138,7 @@ export class Command {
public readonly analyticsName?: SlashCommandEvent["command"]; public readonly analyticsName?: SlashCommandEvent["command"];
private readonly _isEnabled?: () => boolean; private readonly _isEnabled?: () => boolean;
constructor(opts: ICommandOpts) { public constructor(opts: ICommandOpts) {
this.command = opts.command; this.command = opts.command;
this.aliases = opts.aliases || []; this.aliases = opts.aliases || [];
this.args = opts.args || ""; this.args = opts.args || "";

View file

@ -34,7 +34,7 @@ export class Service {
* @param {string} baseUrl The Base URL of the service (ie. before '/_matrix') * @param {string} baseUrl The Base URL of the service (ie. before '/_matrix')
* @param {string} accessToken The user's access token for the service * @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 { export interface LocalisedPolicy {

View file

@ -45,12 +45,12 @@ export default class UserActivity {
private lastScreenX = 0; private lastScreenX = 0;
private lastScreenY = 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.activeNowTimeout = new Timer(CURRENTLY_ACTIVE_THRESHOLD_MS);
this.activeRecentlyTimeout = new Timer(RECENTLY_ACTIVE_THRESHOLD_MS); this.activeRecentlyTimeout = new Timer(RECENTLY_ACTIVE_THRESHOLD_MS);
} }
static sharedInstance() { public static sharedInstance() {
if (window.mxUserActivity === undefined) { if (window.mxUserActivity === undefined) {
window.mxUserActivity = new UserActivity(window, document); window.mxUserActivity = new UserActivity(window, document);
} }

View file

@ -38,7 +38,7 @@ interface IState {
* Allows the user to disable the Event Index. * Allows the user to disable the Event Index.
*/ */
export default class DisableEventIndexDialog extends React.Component<IProps, IState> { export default class DisableEventIndexDialog extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
disabling: false, disabling: false,

View file

@ -43,7 +43,7 @@ interface IState {
* Allows the user to introspect the event index state and disable it. * Allows the user to introspect the event index state and disable it.
*/ */
export default class ManageEventIndexDialog extends React.Component<IProps, IState> { export default class ManageEventIndexDialog extends React.Component<IProps, IState> {
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -56,7 +56,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
}; };
} }
updateCurrentRoom = async (room) => { public updateCurrentRoom = async (room) => {
const eventIndex = EventIndexPeg.get(); const eventIndex = EventIndexPeg.get();
let stats; let stats;
@ -84,7 +84,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
}); });
}; };
componentWillUnmount(): void { public componentWillUnmount(): void {
const eventIndex = EventIndexPeg.get(); const eventIndex = EventIndexPeg.get();
if (eventIndex !== null) { if (eventIndex !== null) {
@ -92,7 +92,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
} }
} }
async componentDidMount(): Promise<void> { public async componentDidMount(): Promise<void> {
let eventIndexSize = 0; let eventIndexSize = 0;
let crawlingRoomsCount = 0; let crawlingRoomsCount = 0;
let roomCount = 0; let roomCount = 0;
@ -141,7 +141,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value); SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value);
}; };
render() { public render() {
const brand = SdkConfig.get().brand; const brand = SdkConfig.get().brand;
let crawlerState; let crawlerState;

View file

@ -67,7 +67,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent<IProps, I
private recoveryKeyNode = createRef<HTMLElement>(); private recoveryKeyNode = createRef<HTMLElement>();
private passphraseField = createRef<Field>(); private passphraseField = createRef<Field>();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -104,7 +104,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
private recoveryKeyNode = createRef<HTMLElement>(); private recoveryKeyNode = createRef<HTMLElement>();
private passphraseField = createRef<Field>(); private passphraseField = createRef<Field>();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
let passPhraseKeySelected; let passPhraseKeySelected;

View file

@ -48,7 +48,7 @@ type AnyPassphrase = KeysStartingWith<IState, "passphrase">;
export default class ExportE2eKeysDialog extends React.Component<IProps, IState> { export default class ExportE2eKeysDialog extends React.Component<IProps, IState> {
private unmounted = false; private unmounted = false;
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -57,7 +57,7 @@ export default class ImportE2eKeysDialog extends React.Component<IProps, IState>
private unmounted = false; private unmounted = false;
private file = createRef<HTMLInputElement>(); private file = createRef<HTMLInputElement>();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -83,7 +83,7 @@ export class Playback extends EventEmitter implements IDestroyable, PlaybackInte
* @param {number[]} seedWaveform Optional seed waveform to present until the proper waveform * @param {number[]} seedWaveform Optional seed waveform to present until the proper waveform
* can be calculated. Contains values between zero and one, inclusive. * 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(); super();
// Capture the file size early as reading the buffer will result in a 0-length buffer left behind // Capture the file size early as reading the buffer will result in a 0-length buffer left behind
this.fileSize = this.buf.byteLength; this.fileSize = this.buf.byteLength;

View file

@ -48,7 +48,7 @@ export class PlaybackQueue {
private currentPlaybackId: string; // event ID, broken out from above for ease of use private currentPlaybackId: string; // event ID, broken out from above for ease of use
private recentFullPlays = new Set<string>(); // event IDs private recentFullPlays = new Set<string>(); // event IDs
constructor(private room: Room) { public constructor(private room: Room) {
this.loadClocks(); this.loadClocks();
SdkContextClass.instance.roomViewStore.addRoomListener(this.room.roomId, (isActive) => { SdkContextClass.instance.roomViewStore.addRoomListener(this.room.roomId, (isActive) => {

View file

@ -43,7 +43,7 @@ class MxVoiceWorklet extends AudioWorkletProcessor {
private nextAmplitudeSecond = 0; private nextAmplitudeSecond = 0;
private amplitudeIndex = 0; private amplitudeIndex = 0;
process(inputs, outputs, parameters) { public process(inputs, outputs, parameters) {
const currentSecond = roundTimeToTargetFreq(currentTime); const currentSecond = roundTimeToTargetFreq(currentTime);
// We special case the first ping because there's a fairly good chance that we'll miss the zeroth // 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 // update. Firefox for instance takes 0.06 seconds (roughly) to call this function for the first

View file

@ -136,7 +136,7 @@ export class VoiceMessageRecording implements IDestroyable {
return this.voiceRecording.isSupported; return this.voiceRecording.isSupported;
} }
destroy(): void { public destroy(): void {
this.playback?.destroy(); this.playback?.destroy();
this.voiceRecording.destroy(); this.voiceRecording.destroy();
} }

View file

@ -36,8 +36,8 @@ export interface IAutocompleteOptions {
} }
export default abstract class AutocompleteProvider { export default abstract class AutocompleteProvider {
commandRegex: RegExp; public commandRegex: RegExp;
forcedCommandRegex: RegExp; public forcedCommandRegex: RegExp;
protected renderingType: TimelineRenderingType = TimelineRenderingType.Room; protected renderingType: TimelineRenderingType = TimelineRenderingType.Room;
@ -59,7 +59,7 @@ export default abstract class AutocompleteProvider {
} }
} }
destroy() { public destroy() {
// stub // stub
} }
@ -70,7 +70,7 @@ export default abstract class AutocompleteProvider {
* @param {boolean} force True if the user is forcing completion * @param {boolean} force True if the user is forcing completion
* @return {object} { command, range } where both objects fields are null if no match * @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; let commandRegex = this.commandRegex;
if (force && this.shouldForceComplete()) { if (force && this.shouldForceComplete()) {
@ -106,19 +106,19 @@ export default abstract class AutocompleteProvider {
}; };
} }
abstract getCompletions( public abstract getCompletions(
query: string, query: string,
selection: ISelectionRange, selection: ISelectionRange,
force: boolean, force: boolean,
limit: number, limit: number,
): Promise<ICompletion[]>; ): Promise<ICompletion[]>;
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. // Whether we should provide completions even if triggered forcefully, without a sigil.
shouldForceComplete(): boolean { public shouldForceComplete(): boolean {
return false; return false;
} }
} }

View file

@ -59,23 +59,23 @@ export interface IProviderCompletions {
} }
export default class Autocompleter { export default class Autocompleter {
room: Room; public room: Room;
providers: AutocompleteProvider[]; public providers: AutocompleteProvider[];
constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) { public constructor(room: Room, renderingType: TimelineRenderingType = TimelineRenderingType.Room) {
this.room = room; this.room = room;
this.providers = PROVIDERS.map((Prov) => { this.providers = PROVIDERS.map((Prov) => {
return new Prov(room, renderingType); return new Prov(room, renderingType);
}); });
} }
destroy() { public destroy() {
this.providers.forEach((p) => { this.providers.forEach((p) => {
p.destroy(); p.destroy();
}); });
} }
async getCompletions( public async getCompletions(
query: string, query: string,
selection: ISelectionRange, selection: ISelectionRange,
force = false, force = false,

View file

@ -31,9 +31,9 @@ import { TimelineRenderingType } from "../contexts/RoomContext";
const COMMAND_RE = /(^\/\w*)(?: .*)?/g; const COMMAND_RE = /(^\/\w*)(?: .*)?/g;
export default class CommandProvider extends AutocompleteProvider { export default class CommandProvider extends AutocompleteProvider {
matcher: QueryMatcher<Command>; public matcher: QueryMatcher<Command>;
constructor(room: Room, renderingType?: TimelineRenderingType) { public constructor(room: Room, renderingType?: TimelineRenderingType) {
super({ commandRegex: COMMAND_RE, renderingType }); super({ commandRegex: COMMAND_RE, renderingType });
this.matcher = new QueryMatcher(Commands, { this.matcher = new QueryMatcher(Commands, {
keys: ["command", "args", "description"], keys: ["command", "args", "description"],
@ -42,7 +42,7 @@ export default class CommandProvider extends AutocompleteProvider {
}); });
} }
async getCompletions( public async getCompletions(
query: string, query: string,
selection: ISelectionRange, selection: ISelectionRange,
force?: boolean, force?: boolean,
@ -100,11 +100,11 @@ export default class CommandProvider extends AutocompleteProvider {
}); });
} }
getName() { public getName() {
return "*️⃣ " + _t("Commands"); return "*️⃣ " + _t("Commands");
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill" className="mx_Autocomplete_Completion_container_pill"

View file

@ -72,11 +72,11 @@ function colonsTrimmed(str: string): string {
} }
export default class EmojiProvider extends AutocompleteProvider { export default class EmojiProvider extends AutocompleteProvider {
matcher: QueryMatcher<ISortedEmoji>; public matcher: QueryMatcher<ISortedEmoji>;
nameMatcher: QueryMatcher<ISortedEmoji>; public nameMatcher: QueryMatcher<ISortedEmoji>;
private readonly recentlyUsed: IEmoji[]; private readonly recentlyUsed: IEmoji[];
constructor(room: Room, renderingType?: TimelineRenderingType) { public constructor(room: Room, renderingType?: TimelineRenderingType) {
super({ commandRegex: EMOJI_REGEX, renderingType }); super({ commandRegex: EMOJI_REGEX, renderingType });
this.matcher = new QueryMatcher<ISortedEmoji>(SORTED_EMOJI, { this.matcher = new QueryMatcher<ISortedEmoji>(SORTED_EMOJI, {
keys: [], keys: [],
@ -93,7 +93,7 @@ export default class EmojiProvider extends AutocompleteProvider {
this.recentlyUsed = Array.from(new Set(recent.get().map(getEmojiFromUnicode).filter(Boolean))); this.recentlyUsed = Array.from(new Set(recent.get().map(getEmojiFromUnicode).filter(Boolean)));
} }
async getCompletions( public async getCompletions(
query: string, query: string,
selection: ISelectionRange, selection: ISelectionRange,
force?: boolean, force?: boolean,
@ -154,11 +154,11 @@ export default class EmojiProvider extends AutocompleteProvider {
return []; return [];
} }
getName() { public getName() {
return "😃 " + _t("Emoji"); return "😃 " + _t("Emoji");
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill" className="mx_Autocomplete_Completion_container_pill"

View file

@ -28,11 +28,16 @@ import { TimelineRenderingType } from "../contexts/RoomContext";
const AT_ROOM_REGEX = /@\S*/g; const AT_ROOM_REGEX = /@\S*/g;
export default class NotifProvider extends AutocompleteProvider { export default class NotifProvider extends AutocompleteProvider {
constructor(public room: Room, renderingType?: TimelineRenderingType) { public constructor(public room: Room, renderingType?: TimelineRenderingType) {
super({ commandRegex: AT_ROOM_REGEX, renderingType }); super({ commandRegex: AT_ROOM_REGEX, renderingType });
} }
async getCompletions(query: string, selection: ISelectionRange, force = false, limit = -1): Promise<ICompletion[]> { public async getCompletions(
query: string,
selection: ISelectionRange,
force = false,
limit = -1,
): Promise<ICompletion[]> {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
if (!this.room.currentState.mayTriggerNotifOfType("room", client.credentials.userId)) return []; if (!this.room.currentState.mayTriggerNotifOfType("room", client.credentials.userId)) return [];
@ -60,11 +65,11 @@ export default class NotifProvider extends AutocompleteProvider {
return []; return [];
} }
getName() { public getName() {
return "❗️ " + _t("Room Notification"); return "❗️ " + _t("Room Notification");
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate" className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate"

View file

@ -49,7 +49,7 @@ export default class QueryMatcher<T extends {}> {
private _options: IOptions<T>; private _options: IOptions<T>;
private _items: Map<string, { object: T; keyWeight: number }[]>; private _items: Map<string, { object: T; keyWeight: number }[]>;
constructor(objects: T[], options: IOptions<T> = { keys: [] }) { public constructor(objects: T[], options: IOptions<T> = { keys: [] }) {
this._options = options; this._options = options;
this.setObjects(objects); this.setObjects(objects);
@ -61,7 +61,7 @@ export default class QueryMatcher<T extends {}> {
} }
} }
setObjects(objects: T[]) { public setObjects(objects: T[]) {
this._items = new Map(); this._items = new Map();
for (const object of objects) { for (const object of objects) {
@ -96,7 +96,7 @@ export default class QueryMatcher<T extends {}> {
} }
} }
match(query: string, limit = -1): T[] { public match(query: string, limit = -1): T[] {
query = this.processQuery(query); query = this.processQuery(query);
if (this._options.shouldMatchWordsOnly) { if (this._options.shouldMatchWordsOnly) {
query = query.replace(/[^\w]/g, ""); query = query.replace(/[^\w]/g, "");

View file

@ -48,7 +48,7 @@ function matcherObject(room: Room, displayedAlias: string, matchName = "") {
export default class RoomProvider extends AutocompleteProvider { export default class RoomProvider extends AutocompleteProvider {
protected matcher: QueryMatcher<Room>; protected matcher: QueryMatcher<Room>;
constructor(room: Room, renderingType?: TimelineRenderingType) { public constructor(room: Room, renderingType?: TimelineRenderingType) {
super({ commandRegex: ROOM_REGEX, renderingType }); super({ commandRegex: ROOM_REGEX, renderingType });
this.matcher = new QueryMatcher([], { this.matcher = new QueryMatcher([], {
keys: ["displayedAlias", "matchName"], keys: ["displayedAlias", "matchName"],
@ -62,7 +62,12 @@ export default class RoomProvider extends AutocompleteProvider {
return cli.getVisibleRooms().filter((r) => !r.isSpaceRoom()); return cli.getVisibleRooms().filter((r) => !r.isSpaceRoom());
} }
async getCompletions(query: string, selection: ISelectionRange, force = false, limit = -1): Promise<ICompletion[]> { public async getCompletions(
query: string,
selection: ISelectionRange,
force = false,
limit = -1,
): Promise<ICompletion[]> {
let completions = []; let completions = [];
const { command, range } = this.getCurrentCommand(query, selection, force); const { command, range } = this.getCurrentCommand(query, selection, force);
if (command) { if (command) {
@ -118,11 +123,11 @@ export default class RoomProvider extends AutocompleteProvider {
return completions; return completions;
} }
getName() { public getName() {
return _t("Rooms"); return _t("Rooms");
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate" className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate"

View file

@ -27,11 +27,11 @@ export default class SpaceProvider extends RoomProvider {
.filter((r) => r.isSpaceRoom()); .filter((r) => r.isSpaceRoom());
} }
getName() { public getName() {
return _t("Spaces"); return _t("Spaces");
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate" className="mx_Autocomplete_Completion_container_pill mx_Autocomplete_Completion_container_truncate"

View file

@ -43,11 +43,11 @@ const USER_REGEX = /\B@\S*/g;
const FORCED_USER_REGEX = /[^/,:; \t\n]\S*/g; const FORCED_USER_REGEX = /[^/,:; \t\n]\S*/g;
export default class UserProvider extends AutocompleteProvider { export default class UserProvider extends AutocompleteProvider {
matcher: QueryMatcher<RoomMember>; public matcher: QueryMatcher<RoomMember>;
users: RoomMember[]; public users: RoomMember[];
room: Room; public room: Room;
constructor(room: Room, renderingType?: TimelineRenderingType) { public constructor(room: Room, renderingType?: TimelineRenderingType) {
super({ super({
commandRegex: USER_REGEX, commandRegex: USER_REGEX,
forcedCommandRegex: FORCED_USER_REGEX, forcedCommandRegex: FORCED_USER_REGEX,
@ -64,7 +64,7 @@ export default class UserProvider extends AutocompleteProvider {
MatrixClientPeg.get().on(RoomStateEvent.Update, this.onRoomStateUpdate); MatrixClientPeg.get().on(RoomStateEvent.Update, this.onRoomStateUpdate);
} }
destroy() { public destroy() {
if (MatrixClientPeg.get()) { if (MatrixClientPeg.get()) {
MatrixClientPeg.get().removeListener(RoomEvent.Timeline, this.onRoomTimeline); MatrixClientPeg.get().removeListener(RoomEvent.Timeline, this.onRoomTimeline);
MatrixClientPeg.get().removeListener(RoomStateEvent.Update, this.onRoomStateUpdate); MatrixClientPeg.get().removeListener(RoomStateEvent.Update, this.onRoomStateUpdate);
@ -101,7 +101,7 @@ export default class UserProvider extends AutocompleteProvider {
this.users = null; this.users = null;
}; };
async getCompletions( public async getCompletions(
rawQuery: string, rawQuery: string,
selection: ISelectionRange, selection: ISelectionRange,
force = false, force = false,
@ -146,7 +146,7 @@ export default class UserProvider extends AutocompleteProvider {
return completions; return completions;
} }
getName(): string { public getName(): string {
return _t("Users"); return _t("Users");
} }
@ -167,7 +167,7 @@ export default class UserProvider extends AutocompleteProvider {
this.matcher.setObjects(this.users); this.matcher.setObjects(this.users);
} }
onUserSpoke(user: RoomMember) { public onUserSpoke(user: RoomMember) {
if (!this.users) return; if (!this.users) return;
if (!user) return; if (!user) return;
if (user.userId === MatrixClientPeg.get().credentials.userId) return; if (user.userId === MatrixClientPeg.get().credentials.userId) return;
@ -182,7 +182,7 @@ export default class UserProvider extends AutocompleteProvider {
this.matcher.setObjects(this.users); this.matcher.setObjects(this.users);
} }
renderCompletions(completions: React.ReactNode[]): React.ReactNode { public renderCompletions(completions: React.ReactNode[]): React.ReactNode {
return ( return (
<div <div
className="mx_Autocomplete_Completion_container_pill" className="mx_Autocomplete_Completion_container_pill"
@ -194,7 +194,7 @@ export default class UserProvider extends AutocompleteProvider {
); );
} }
shouldForceComplete(): boolean { public shouldForceComplete(): boolean {
return true; return true;
} }
} }

View file

@ -33,7 +33,7 @@ export type IProps<T extends keyof JSX.IntrinsicElements> = DynamicHtmlElementPr
}; };
export default class AutoHideScrollbar<T extends keyof JSX.IntrinsicElements> extends React.Component<IProps<T>> { export default class AutoHideScrollbar<T extends keyof JSX.IntrinsicElements> extends React.Component<IProps<T>> {
static defaultProps = { public static defaultProps = {
element: "div" as keyof ReactHTML, element: "div" as keyof ReactHTML,
}; };

View file

@ -112,12 +112,12 @@ interface IState {
export default class ContextMenu extends React.PureComponent<IProps, IState> { export default class ContextMenu extends React.PureComponent<IProps, IState> {
private readonly initialFocus: HTMLElement; private readonly initialFocus: HTMLElement;
static defaultProps = { public static defaultProps = {
hasBackground: true, hasBackground: true,
managed: true, managed: true,
}; };
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {
@ -447,7 +447,7 @@ export default class ContextMenu extends React.PureComponent<IProps, IState> {
); );
} }
render(): React.ReactChild { public render(): React.ReactChild {
if (this.props.mountAsChild) { if (this.props.mountAsChild) {
// Render as a child of the current parent // Render as a child of the current parent
return this.renderMenu(); return this.renderMenu();

View file

@ -48,7 +48,7 @@ export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
private unmounted = false; private unmounted = false;
private dispatcherRef: string = null; private dispatcherRef: string = null;
constructor(props: IProps, context: typeof MatrixClientContext) { public constructor(props: IProps, context: typeof MatrixClientContext) {
super(props, context); super(props, context);
this.state = { this.state = {

View file

@ -51,7 +51,7 @@ interface IState {
* Component which shows the filtered file using a TimelinePanel * Component which shows the filtered file using a TimelinePanel
*/ */
class FilePanel extends React.Component<IProps, IState> { class FilePanel extends React.Component<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
// This is used to track if a decrypted event was a live event and should be // This is used to track if a decrypted event was a live event and should be
// added to the timeline. // added to the timeline.
@ -59,7 +59,7 @@ class FilePanel extends React.Component<IProps, IState> {
public noRoom: boolean; public noRoom: boolean;
private card = createRef<HTMLDivElement>(); private card = createRef<HTMLDivElement>();
state = { public state = {
timelineSet: null, timelineSet: null,
narrow: false, narrow: false,
}; };

View file

@ -22,7 +22,7 @@ interface IProps {
} }
export default class GenericErrorPage extends React.PureComponent<IProps> { export default class GenericErrorPage extends React.PureComponent<IProps> {
render() { public render() {
return ( return (
<div className="mx_GenericErrorPage"> <div className="mx_GenericErrorPage">
<div className="mx_GenericErrorPage_box"> <div className="mx_GenericErrorPage_box">

View file

@ -47,7 +47,7 @@ export default class IndicatorScrollbar<T extends keyof JSX.IntrinsicElements> e
private likelyTrackpadUser: boolean = null; private likelyTrackpadUser: boolean = null;
private checkAgainForTrackpad = 0; // ts in milliseconds to recheck this._likelyTrackpadUser private checkAgainForTrackpad = 0; // ts in milliseconds to recheck this._likelyTrackpadUser
constructor(props: IProps<T>) { public constructor(props: IProps<T>) {
super(props); super(props);
this.state = { this.state = {

View file

@ -99,7 +99,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
private unmounted = false; private unmounted = false;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -155,7 +155,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
}); });
} }
componentWillUnmount() { public componentWillUnmount() {
this.unmounted = true; this.unmounted = true;
if (this.intervalId !== null) { if (this.intervalId !== null) {
@ -249,7 +249,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
this.authLogic.setEmailSid(sid); this.authLogic.setEmailSid(sid);
}; };
render() { public render() {
const stage = this.state.authStage; const stage = this.state.authStage;
if (!stage) { if (!stage) {
if (this.state.busy) { if (this.state.busy) {

View file

@ -71,7 +71,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
private focusedElement = null; private focusedElement = null;
private isDoingStickyHeaders = false; private isDoingStickyHeaders = false;
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -75,7 +75,7 @@ export default class LegacyCallEventGrouper extends EventEmitter {
private call: MatrixCall; private call: MatrixCall;
public state: CallState | CustomCallState; public state: CallState | CustomCallState;
constructor() { public constructor() {
super(); super();
LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallsChanged, this.setCall); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallsChanged, this.setCall);

View file

@ -125,7 +125,7 @@ interface IState {
* Components mounted below us can access the matrix client via the react context. * Components mounted below us can access the matrix client via the react context.
*/ */
class LoggedInView extends React.Component<IProps, IState> { class LoggedInView extends React.Component<IProps, IState> {
static displayName = "LoggedInView"; public static displayName = "LoggedInView";
protected readonly _matrixClient: MatrixClient; protected readonly _matrixClient: MatrixClient;
protected readonly _roomView: React.RefObject<RoomViewType>; protected readonly _roomView: React.RefObject<RoomViewType>;
@ -136,7 +136,7 @@ class LoggedInView extends React.Component<IProps, IState> {
protected backgroundImageWatcherRef: string; protected backgroundImageWatcherRef: string;
protected resizer: Resizer; protected resizer: Resizer;
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {
@ -159,7 +159,7 @@ class LoggedInView extends React.Component<IProps, IState> {
this.resizeHandler = React.createRef(); this.resizeHandler = React.createRef();
} }
componentDidMount() { public componentDidMount() {
document.addEventListener("keydown", this.onNativeKeyDown, false); document.addEventListener("keydown", this.onNativeKeyDown, false);
LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallState, this.onCallState); LegacyCallHandler.instance.addListener(LegacyCallHandlerEvent.CallState, this.onCallState);
@ -191,7 +191,7 @@ class LoggedInView extends React.Component<IProps, IState> {
this.refreshBackgroundImage(); this.refreshBackgroundImage();
} }
componentWillUnmount() { public componentWillUnmount() {
document.removeEventListener("keydown", this.onNativeKeyDown, false); document.removeEventListener("keydown", this.onNativeKeyDown, false);
LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallState, this.onCallState); LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallState, this.onCallState);
this._matrixClient.removeListener(ClientEvent.AccountData, this.onAccountData); this._matrixClient.removeListener(ClientEvent.AccountData, this.onAccountData);
@ -621,7 +621,7 @@ class LoggedInView extends React.Component<IProps, IState> {
} }
}; };
render() { public render() {
let pageElement; let pageElement;
switch (this.props.page_type) { switch (this.props.page_type) {

View file

@ -210,9 +210,9 @@ interface IState {
} }
export default class MatrixChat extends React.PureComponent<IProps, IState> { export default class MatrixChat extends React.PureComponent<IProps, IState> {
static displayName = "MatrixChat"; public static displayName = "MatrixChat";
static defaultProps = { public static defaultProps = {
realQueryParams: {}, realQueryParams: {},
startingFragmentQueryParams: {}, startingFragmentQueryParams: {},
config: {}, config: {},
@ -237,7 +237,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
private readonly fontWatcher: FontWatcher; private readonly fontWatcher: FontWatcher;
private readonly stores: SdkContextClass; private readonly stores: SdkContextClass;
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.stores = SdkContextClass.instance; this.stores = SdkContextClass.instance;
this.stores.constructEagerStores(); this.stores.constructEagerStores();
@ -417,7 +417,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
window.addEventListener("resize", this.onWindowResized); window.addEventListener("resize", this.onWindowResized);
} }
componentDidUpdate(prevProps, prevState) { public componentDidUpdate(prevProps, prevState) {
if (this.shouldTrackPageChange(prevState, this.state)) { if (this.shouldTrackPageChange(prevState, this.state)) {
const durationMs = this.stopPageChangeTimer(); const durationMs = this.stopPageChangeTimer();
PosthogTrackers.instance.trackPageChange(this.state.view, this.state.page_type, durationMs); PosthogTrackers.instance.trackPageChange(this.state.view, this.state.page_type, durationMs);
@ -428,7 +428,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} }
} }
componentWillUnmount() { public componentWillUnmount() {
Lifecycle.stopMatrixClient(); Lifecycle.stopMatrixClient();
dis.unregister(this.dispatcherRef); dis.unregister(this.dispatcherRef);
this.themeWatcher.stop(); this.themeWatcher.stop();
@ -2016,7 +2016,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
return fragmentAfterLogin; return fragmentAfterLogin;
} }
render() { public render() {
const fragmentAfterLogin = this.getFragmentAfterLogin(); const fragmentAfterLogin = this.getFragmentAfterLogin();
let view = null; let view = null;

View file

@ -214,10 +214,10 @@ interface IReadReceiptForUser {
/* (almost) stateless UI component which builds the event tiles in the room timeline. /* (almost) stateless UI component which builds the event tiles in the room timeline.
*/ */
export default class MessagePanel extends React.Component<IProps, IState> { export default class MessagePanel extends React.Component<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
static defaultProps = { public static defaultProps = {
disableGrouping: false, disableGrouping: false,
}; };
@ -272,7 +272,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
// A map to allow groupers to maintain consistent keys even if their first event is uprooted due to back-pagination. // A map to allow groupers to maintain consistent keys even if their first event is uprooted due to back-pagination.
public grouperKeyMap = new WeakMap<MatrixEvent, string>(); public grouperKeyMap = new WeakMap<MatrixEvent, string>();
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {
@ -296,19 +296,19 @@ export default class MessagePanel extends React.Component<IProps, IState> {
); );
} }
componentDidMount() { public componentDidMount() {
this.calculateRoomMembersCount(); this.calculateRoomMembersCount();
this.props.room?.currentState.on(RoomStateEvent.Update, this.calculateRoomMembersCount); this.props.room?.currentState.on(RoomStateEvent.Update, this.calculateRoomMembersCount);
this.isMounted = true; this.isMounted = true;
} }
componentWillUnmount() { public componentWillUnmount() {
this.isMounted = false; this.isMounted = false;
this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount); this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount);
SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef); SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef);
} }
componentDidUpdate(prevProps, prevState) { public componentDidUpdate(prevProps, prevState) {
if (prevProps.layout !== this.props.layout) { if (prevProps.layout !== this.props.layout) {
this.calculateRoomMembersCount(); this.calculateRoomMembersCount();
} }
@ -982,7 +982,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
} }
} }
render() { public render() {
let topSpinner; let topSpinner;
let bottomSpinner; let bottomSpinner;
if (this.props.backPaginating) { if (this.props.backPaginating) {
@ -1057,14 +1057,14 @@ export default class MessagePanel extends React.Component<IProps, IState> {
} }
abstract class BaseGrouper { abstract class BaseGrouper {
static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true; public static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true;
public events: MatrixEvent[] = []; public events: MatrixEvent[] = [];
// events that we include in the group but then eject out and place above the group. // events that we include in the group but then eject out and place above the group.
public ejectedEvents: MatrixEvent[] = []; public ejectedEvents: MatrixEvent[] = [];
public readMarker: ReactNode; public readMarker: ReactNode;
constructor( public constructor(
public readonly panel: MessagePanel, public readonly panel: MessagePanel,
public readonly event: MatrixEvent, public readonly event: MatrixEvent,
public readonly prevEvent: 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 // 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 // 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 { 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; return ev.getType() === EventType.RoomCreate;
}; };
@ -1231,7 +1231,7 @@ class CreationGrouper extends BaseGrouper {
// Wrap consecutive grouped events in a ListSummary // Wrap consecutive grouped events in a ListSummary
class MainGrouper extends BaseGrouper { 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 (!panel.shouldShowEvent(ev)) return false;
if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) { if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) {
@ -1249,7 +1249,7 @@ class MainGrouper extends BaseGrouper {
return false; return false;
}; };
constructor( public constructor(
public readonly panel: MessagePanel, public readonly panel: MessagePanel,
public readonly event: MatrixEvent, public readonly event: MatrixEvent,
public readonly prevEvent: MatrixEvent, public readonly prevEvent: MatrixEvent,

View file

@ -38,11 +38,11 @@ interface IState {
* Component which shows the global notification list using a TimelinePanel * Component which shows the global notification list using a TimelinePanel
*/ */
export default class NotificationPanel extends React.PureComponent<IProps, IState> { export default class NotificationPanel extends React.PureComponent<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
private card = React.createRef<HTMLDivElement>(); private card = React.createRef<HTMLDivElement>();
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -54,7 +54,7 @@ export default class NotificationPanel extends React.PureComponent<IProps, IStat
this.setState({ narrow }); this.setState({ narrow });
}; };
render() { public render() {
const emptyState = ( const emptyState = (
<div className="mx_RightPanel_empty mx_NotificationPanel_empty"> <div className="mx_RightPanel_empty mx_NotificationPanel_empty">
<h2>{_t("You're all caught up")}</h2> <h2>{_t("You're all caught up")}</h2>

View file

@ -60,10 +60,10 @@ interface IState {
} }
export default class RightPanel extends React.Component<IProps, IState> { export default class RightPanel extends React.Component<IProps, IState> {
static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public context!: React.ContextType<typeof MatrixClientContext>;
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {

View file

@ -33,7 +33,7 @@ interface IProps {
export default class RoomSearch extends React.PureComponent<IProps> { export default class RoomSearch extends React.PureComponent<IProps> {
private readonly dispatcherRef: string; private readonly dispatcherRef: string;
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.dispatcherRef = defaultDispatcher.register(this.onAction); this.dispatcherRef = defaultDispatcher.register(this.onAction);

View file

@ -89,7 +89,7 @@ export default class RoomStatusBar extends React.PureComponent<IProps, IState> {
private unmounted = false; private unmounted = false;
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
constructor(props: IProps, context: typeof MatrixClientContext) { public constructor(props: IProps, context: typeof MatrixClientContext) {
super(props, context); super(props, context);
this.state = { this.state = {

View file

@ -371,10 +371,10 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
private messagePanel: TimelinePanel; private messagePanel: TimelinePanel;
private roomViewBody = createRef<HTMLDivElement>(); private roomViewBody = createRef<HTMLDivElement>();
static contextType = SDKContext; public static contextType = SDKContext;
public context!: React.ContextType<typeof SDKContext>; public context!: React.ContextType<typeof SDKContext>;
constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) { public constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) {
super(props, context); super(props, context);
const llMembers = context.client.hasLazyLoadMembersEnabled(); const llMembers = context.client.hasLazyLoadMembersEnabled();
@ -838,7 +838,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
return isManuallyShown && widgets.length > 0; return isManuallyShown && widgets.length > 0;
} }
componentDidMount() { public componentDidMount() {
this.onRoomViewStoreUpdate(true); this.onRoomViewStoreUpdate(true);
const call = this.getCallForRoom(); const call = this.getCallForRoom();
@ -851,7 +851,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
window.addEventListener("beforeunload", this.onPageUnload); window.addEventListener("beforeunload", this.onPageUnload);
} }
shouldComponentUpdate(nextProps, nextState) { public shouldComponentUpdate(nextProps, nextState) {
const hasPropsDiff = objectHasDiff(this.props, nextProps); const hasPropsDiff = objectHasDiff(this.props, nextProps);
const { upgradeRecommendation, ...state } = this.state; const { upgradeRecommendation, ...state } = this.state;
@ -864,7 +864,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
return hasPropsDiff || hasStateDiff; return hasPropsDiff || hasStateDiff;
} }
componentDidUpdate() { public componentDidUpdate() {
// Note: We check the ref here with a flag because componentDidMount, despite // Note: We check the ref here with a flag because componentDidMount, despite
// documentation, does not define our messagePanel ref. It looks like our spinner // 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 // 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<IRoomProps, IRoomState> {
} }
} }
componentWillUnmount() { public componentWillUnmount() {
// set a boolean to say we've been unmounted, which any pending // set a boolean to say we've been unmounted, which any pending
// promises can use to throw away their results. // promises can use to throw away their results.
// //
@ -1804,13 +1804,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
return this.context.client.getRoom(createEvent.getContent()["predecessor"]["room_id"]); return this.context.client.getRoom(createEvent.getContent()["predecessor"]["room_id"]);
} }
getHiddenHighlightCount() { public getHiddenHighlightCount() {
const oldRoom = this.getOldRoom(); const oldRoom = this.getOldRoom();
if (!oldRoom) return 0; if (!oldRoom) return 0;
return oldRoom.getUnreadNotificationCount(NotificationCountType.Highlight); return oldRoom.getUnreadNotificationCount(NotificationCountType.Highlight);
} }
onHiddenHighlightsClick = () => { public onHiddenHighlightsClick = () => {
const oldRoom = this.getOldRoom(); const oldRoom = this.getOldRoom();
if (!oldRoom) return; if (!oldRoom) return;
dis.dispatch<ViewRoomPayload>({ dis.dispatch<ViewRoomPayload>({
@ -1869,7 +1869,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
); );
} }
render() { public render() {
if (this.state.room instanceof LocalRoom) { if (this.state.room instanceof LocalRoom) {
if (this.state.room.state === LocalRoomState.CREATING) { if (this.state.room.state === LocalRoomState.CREATING) {
return this.renderLocalRoomCreateLoader(); return this.renderLocalRoomCreateLoader();

View file

@ -195,7 +195,7 @@ export default class ScrollPanel extends React.Component<IProps> {
private heightUpdateInProgress: boolean; private heightUpdateInProgress: boolean;
private divScroll: HTMLDivElement; private divScroll: HTMLDivElement;
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.props.resizeNotifier?.on("middlePanelResizedNoisy", this.onResize); this.props.resizeNotifier?.on("middlePanelResizedNoisy", this.onResize);

View file

@ -45,7 +45,7 @@ interface IState {
export default class SearchBox extends React.Component<IProps, IState> { export default class SearchBox extends React.Component<IProps, IState> {
private search = createRef<HTMLInputElement>(); private search = createRef<HTMLInputElement>();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -611,13 +611,13 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
}; };
export default class SpaceRoomView extends React.PureComponent<IProps, IState> { export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public context!: React.ContextType<typeof MatrixClientContext>;
private readonly creator: string; private readonly creator: string;
private readonly dispatcherRef: string; private readonly dispatcherRef: string;
constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);
let phase = Phase.Landing; let phase = Phase.Landing;
@ -642,11 +642,11 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate); RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
} }
componentDidMount() { public componentDidMount() {
this.context.on(RoomEvent.MyMembership, this.onMyMembership); this.context.on(RoomEvent.MyMembership, this.onMyMembership);
} }
componentWillUnmount() { public componentWillUnmount() {
defaultDispatcher.unregister(this.dispatcherRef); defaultDispatcher.unregister(this.dispatcherRef);
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate); RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
this.context.off(RoomEvent.MyMembership, this.onMyMembership); this.context.off(RoomEvent.MyMembership, this.onMyMembership);
@ -794,7 +794,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
} }
} }
render() { public render() {
const rightPanel = const rightPanel =
this.state.showRightPanel && this.state.phase === Phase.Landing ? ( this.state.showRightPanel && this.state.phase === Phase.Landing ? (
<RightPanel room={this.props.space} resizeNotifier={this.props.resizeNotifier} /> <RightPanel room={this.props.space} resizeNotifier={this.props.resizeNotifier} />

View file

@ -37,7 +37,7 @@ export class Tab {
* @param {React.ReactNode} body The JSX for the tab container. * @param {React.ReactNode} body The JSX for the tab container.
* @param {string} screenName The screen name to report to Posthog. * @param {string} screenName The screen name to report to Posthog.
*/ */
constructor( public constructor(
public readonly id: string, public readonly id: string,
public readonly label: string, public readonly label: string,
public readonly icon: string, public readonly icon: string,
@ -64,7 +64,7 @@ interface IState {
} }
export default class TabbedView extends React.Component<IProps, IState> { export default class TabbedView extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId); const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId);
@ -73,7 +73,7 @@ export default class TabbedView extends React.Component<IProps, IState> {
}; };
} }
static defaultProps = { public static defaultProps = {
tabLocation: TabLocation.LEFT, tabLocation: TabLocation.LEFT,
}; };

View file

@ -76,7 +76,7 @@ interface IState {
} }
export default class ThreadView extends React.Component<IProps, IState> { export default class ThreadView extends React.Component<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
private dispatcherRef: string; private dispatcherRef: string;
@ -84,7 +84,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
private timelinePanel = createRef<TimelinePanel>(); private timelinePanel = createRef<TimelinePanel>();
private card = createRef<HTMLDivElement>(); private card = createRef<HTMLDivElement>();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
const thread = this.props.room.getThread(this.props.mxEvent.getId()); const thread = this.props.room.getThread(this.props.mxEvent.getId());

View file

@ -227,13 +227,13 @@ interface IEventIndexOpts {
* Also responsible for handling and sending read receipts. * Also responsible for handling and sending read receipts.
*/ */
class TimelinePanel extends React.Component<IProps, IState> { class TimelinePanel extends React.Component<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
// a map from room id to read marker event timestamp // a map from room id to read marker event timestamp
static roomReadMarkerTsMap: Record<string, number> = {}; public static roomReadMarkerTsMap: Record<string, number> = {};
static defaultProps = { public static defaultProps = {
// By default, disable the timelineCap in favour of unpaginating based on // By default, disable the timelineCap in favour of unpaginating based on
// event tile heights. (See _unpaginateEvents) // event tile heights. (See _unpaginateEvents)
timelineCap: Number.MAX_VALUE, timelineCap: Number.MAX_VALUE,
@ -257,7 +257,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// A map of <callId, LegacyCallEventGrouper> // A map of <callId, LegacyCallEventGrouper>
private callEventGroupers = new Map<string, LegacyCallEventGrouper>(); private callEventGroupers = new Map<string, LegacyCallEventGrouper>();
constructor(props: IProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context); super(props, context);
this.context = context; this.context = context;
@ -360,7 +360,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
} }
componentWillUnmount() { public componentWillUnmount() {
// set a boolean to say we've been unmounted, which any pending // set a boolean to say we've been unmounted, which any pending
// promises can use to throw away their results. // promises can use to throw away their results.
// //
@ -1883,7 +1883,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
this.callEventGroupers = buildLegacyCallEventGroupers(this.callEventGroupers, events); this.callEventGroupers = buildLegacyCallEventGroupers(this.callEventGroupers, events);
} }
render() { public render() {
// just show a spinner while the timeline loads. // just show a spinner while the timeline loads.
// //
// put it in a div of the right class (mx_RoomView_messagePanel) so // put it in a div of the right class (mx_RoomView_messagePanel) so

View file

@ -25,7 +25,7 @@ interface IState {
} }
export default class ToastContainer extends React.Component<{}, IState> { export default class ToastContainer extends React.Component<{}, IState> {
constructor(props, context) { public constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {
toasts: ToastStore.sharedInstance().getToasts(), toasts: ToastStore.sharedInstance().getToasts(),
@ -39,7 +39,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
ToastStore.sharedInstance().on("update", this.onToastStoreUpdate); ToastStore.sharedInstance().on("update", this.onToastStoreUpdate);
} }
componentWillUnmount() { public componentWillUnmount() {
ToastStore.sharedInstance().removeListener("update", this.onToastStoreUpdate); 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 totalCount = this.state.toasts.length;
const isStacked = totalCount > 1; const isStacked = totalCount > 1;
let toast; let toast;

View file

@ -57,7 +57,7 @@ export default class UploadBar extends React.PureComponent<IProps, IState> {
private dispatcherRef: Optional<string>; private dispatcherRef: Optional<string>;
private mounted = false; private mounted = false;
constructor(props) { public constructor(props) {
super(props); super(props);
// Set initial state to any available upload in this room - we might be mounting // 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<IProps, IState> {
this.state = this.calculateState(); this.state = this.calculateState();
} }
componentDidMount() { public componentDidMount() {
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = dis.register(this.onAction);
this.mounted = true; this.mounted = true;
} }
componentWillUnmount() { public componentWillUnmount() {
this.mounted = false; this.mounted = false;
dis.unregister(this.dispatcherRef!); dis.unregister(this.dispatcherRef!);
} }
@ -103,7 +103,7 @@ export default class UploadBar extends React.PureComponent<IProps, IState> {
ContentMessages.sharedInstance().cancelUpload(this.state.currentUpload!); ContentMessages.sharedInstance().cancelUpload(this.state.currentUpload!);
}; };
render() { public render() {
if (!this.state.currentFile) { if (!this.state.currentFile) {
return null; return null;
} }

View file

@ -93,7 +93,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
private buttonRef: React.RefObject<HTMLButtonElement> = createRef(); private buttonRef: React.RefObject<HTMLButtonElement> = createRef();
private voiceBroadcastRecordingStore = VoiceBroadcastRecordingsStore.instance(); private voiceBroadcastRecordingStore = VoiceBroadcastRecordingsStore.instance();
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -41,7 +41,7 @@ interface IState {
} }
export default class UserView extends React.Component<IProps, IState> { export default class UserView extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
loading: true, loading: true,

View file

@ -40,7 +40,7 @@ interface IState {
} }
export default class ViewSource extends React.Component<IProps, IState> { export default class ViewSource extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -33,7 +33,7 @@ interface IState {
} }
export default class CompleteSecurity extends React.Component<IProps, IState> { export default class CompleteSecurity extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
const store = SetupEncryptionStore.sharedInstance(); const store = SetupEncryptionStore.sharedInstance();
store.on("update", this.onStoreUpdate); store.on("update", this.onStoreUpdate);

View file

@ -27,7 +27,7 @@ interface IProps {
} }
export default class E2eSetup extends React.Component<IProps> { export default class E2eSetup extends React.Component<IProps> {
render() { public render() {
return ( return (
<AuthPage> <AuthPage>
<CompleteSecurityBody> <CompleteSecurityBody>

View file

@ -350,7 +350,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
} as any); } as any);
}; };
renderEnterEmail(): JSX.Element { public renderEnterEmail(): JSX.Element {
return ( return (
<EnterEmail <EnterEmail
email={this.state.email} email={this.state.email}
@ -364,7 +364,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
); );
} }
async renderConfirmLogoutDevicesDialog(): Promise<boolean> { public async renderConfirmLogoutDevicesDialog(): Promise<boolean> {
const { finished } = Modal.createDialog<[boolean]>(QuestionDialog, { const { finished } = Modal.createDialog<[boolean]>(QuestionDialog, {
title: _t("Warning!"), title: _t("Warning!"),
description: ( description: (
@ -395,7 +395,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
return confirmed; return confirmed;
} }
renderCheckEmail(): JSX.Element { public renderCheckEmail(): JSX.Element {
return ( return (
<CheckEmail <CheckEmail
email={this.state.email} email={this.state.email}
@ -407,7 +407,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
); );
} }
renderSetPassword(): JSX.Element { public renderSetPassword(): JSX.Element {
const submitButtonChild = const submitButtonChild =
this.state.phase === Phase.ResettingPassword ? <Spinner w={16} h={16} /> : _t("Reset password"); this.state.phase === Phase.ResettingPassword ? <Spinner w={16} h={16} /> : _t("Reset password");
@ -460,7 +460,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
); );
} }
renderDone() { public renderDone() {
return ( return (
<> <>
<CheckboxIcon className="mx_Icon mx_Icon_32 mx_Icon_accent" /> <CheckboxIcon className="mx_Icon mx_Icon_32 mx_Icon_accent" />
@ -484,7 +484,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
); );
} }
render() { public render() {
let resetPasswordJsx: JSX.Element; let resetPasswordJsx: JSX.Element;
switch (this.state.phase) { switch (this.state.phase) {

View file

@ -110,7 +110,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
private readonly stepRendererMap: Record<string, () => ReactNode>; private readonly stepRendererMap: Record<string, () => ReactNode>;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -148,7 +148,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
this.initLoginLogic(this.props.serverConfig); this.initLoginLogic(this.props.serverConfig);
} }
componentWillUnmount() { public componentWillUnmount() {
this.unmounted = true; this.unmounted = true;
} }
@ -162,9 +162,9 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
} }
} }
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) { if (!this.state.serverIsAlive) {
this.setState({ busy: true }); this.setState({ busy: true });
// Do a quick liveliness check on the URLs // Do a quick liveliness check on the URLs
@ -264,11 +264,11 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
); );
}; };
onUsernameChanged = (username) => { public onUsernameChanged = (username) => {
this.setState({ username: username }); this.setState({ username: username });
}; };
onUsernameBlur = async (username) => { public onUsernameBlur = async (username) => {
const doWellknownLookup = username[0] === "@"; const doWellknownLookup = username[0] === "@";
this.setState({ this.setState({
username: username, username: username,
@ -315,23 +315,23 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
} }
}; };
onPhoneCountryChanged = (phoneCountry) => { public onPhoneCountryChanged = (phoneCountry) => {
this.setState({ phoneCountry: phoneCountry }); this.setState({ phoneCountry: phoneCountry });
}; };
onPhoneNumberChanged = (phoneNumber) => { public onPhoneNumberChanged = (phoneNumber) => {
this.setState({ this.setState({
phoneNumber: phoneNumber, phoneNumber: phoneNumber,
}); });
}; };
onRegisterClick = (ev) => { public onRegisterClick = (ev) => {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
this.props.onRegisterClick(); this.props.onRegisterClick();
}; };
onTryRegisterClick = (ev) => { public onTryRegisterClick = (ev) => {
const hasPasswordFlow = this.state.flows?.find((flow) => flow.type === "m.login.password"); 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"); 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. // 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<IProps, IState>
return errorText; return errorText;
} }
renderLoginComponentForFlows() { public renderLoginComponentForFlows() {
if (!this.state.flows) return null; if (!this.state.flows) return null;
// this is the ideal order we want to show the flows in // this is the ideal order we want to show the flows in
@ -553,7 +553,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
); );
}; };
render() { public render() {
const loader = const loader =
this.isBusy() && !this.state.busyLoggingIn ? ( this.isBusy() && !this.state.busyLoggingIn ? (
<div className="mx_Login_loader"> <div className="mx_Login_loader">

View file

@ -125,7 +125,7 @@ export default class Registration extends React.Component<IProps, IState> {
// `replaceClient` tracks latest serverConfig to spot when it changes under the async method which fetches flows // `replaceClient` tracks latest serverConfig to spot when it changes under the async method which fetches flows
private latestServerConfig: ValidatedServerConfig; private latestServerConfig: ValidatedServerConfig;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -148,13 +148,13 @@ export default class Registration extends React.Component<IProps, IState> {
}); });
} }
componentDidMount() { public componentDidMount() {
this.replaceClient(this.props.serverConfig); this.replaceClient(this.props.serverConfig);
//triggers a confirmation dialog for data loss before page unloads/refreshes //triggers a confirmation dialog for data loss before page unloads/refreshes
window.addEventListener("beforeunload", this.unloadCallback); window.addEventListener("beforeunload", this.unloadCallback);
} }
componentWillUnmount() { public componentWillUnmount() {
window.removeEventListener("beforeunload", this.unloadCallback); window.removeEventListener("beforeunload", this.unloadCallback);
} }
@ -565,7 +565,7 @@ export default class Registration extends React.Component<IProps, IState> {
} }
} }
render() { public render() {
let errorText; let errorText;
const err = this.state.errorText; const err = this.state.errorText;
if (err) { if (err) {

View file

@ -45,7 +45,7 @@ interface IState {
} }
export default class SetupEncryptionBody extends React.Component<IProps, IState> { export default class SetupEncryptionBody extends React.Component<IProps, IState> {
constructor(props) { public constructor(props) {
super(props); super(props);
const store = SetupEncryptionStore.sharedInstance(); const store = SetupEncryptionStore.sharedInstance();
store.on("update", this.onStoreUpdate); store.on("update", this.onStoreUpdate);

View file

@ -42,7 +42,7 @@ export default abstract class AudioPlayerBase<T extends IProps = IProps> extends
protected seekRef: RefObject<SeekBar> = createRef(); protected seekRef: RefObject<SeekBar> = createRef();
protected playPauseRef: RefObject<PlayPauseButton> = createRef(); protected playPauseRef: RefObject<PlayPauseButton> = createRef();
constructor(props: T) { public constructor(props: T) {
super(props); super(props);
// Playback instances can be reused in the composer // Playback instances can be reused in the composer

View file

@ -39,14 +39,14 @@ export default class LiveRecordingClock extends React.PureComponent<IProps, ISta
() => requestAnimationFrame(() => this.scheduledUpdate.trigger()), () => requestAnimationFrame(() => this.scheduledUpdate.trigger()),
); );
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
seconds: 0, seconds: 0,
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => {
this.seconds = update.timeSeconds; this.seconds = update.timeSeconds;
this.scheduledUpdate.mark(); this.scheduledUpdate.mark();

View file

@ -44,14 +44,14 @@ export default class LiveRecordingWaveform extends React.PureComponent<IProps, I
() => requestAnimationFrame(() => this.scheduledUpdate.trigger()), () => requestAnimationFrame(() => this.scheduledUpdate.trigger()),
); );
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
waveform: arraySeed(0, RECORDING_PLAYBACK_SAMPLES), waveform: arraySeed(0, RECORDING_PLAYBACK_SAMPLES),
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => { this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => {
// The incoming data is between zero and one, so we don't need to clamp/rescale it. // 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); this.waveform = arrayFastResample(Array.from(update.waveform), RECORDING_PLAYBACK_SAMPLES);

View file

@ -56,7 +56,7 @@ export default class SeekBar extends React.PureComponent<IProps, IState> {
disabled: false, disabled: false,
}; };
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -34,14 +34,14 @@ interface ICaptchaFormState {
* A pure UI component which displays a captcha form. * A pure UI component which displays a captcha form.
*/ */
export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICaptchaFormState> { export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICaptchaFormState> {
static defaultProps = { public static defaultProps = {
onCaptchaResponse: () => {}, onCaptchaResponse: () => {},
}; };
private captchaWidgetId?: string; private captchaWidgetId?: string;
private recaptchaContainer = createRef<HTMLDivElement>(); private recaptchaContainer = createRef<HTMLDivElement>();
constructor(props: ICaptchaFormProps) { public constructor(props: ICaptchaFormProps) {
super(props); super(props);
this.state = { this.state = {
@ -49,7 +49,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}; };
} }
componentDidMount() { public componentDidMount() {
// Just putting a script tag into the returned jsx doesn't work, annoyingly, // Just putting a script tag into the returned jsx doesn't work, annoyingly,
// so we do this instead. // so we do this instead.
if (this.isRecaptchaReady()) { if (this.isRecaptchaReady()) {
@ -69,7 +69,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
} }
} }
componentWillUnmount() { public componentWillUnmount() {
this.resetRecaptcha(); this.resetRecaptcha();
} }
@ -122,7 +122,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
} }
} }
render() { public render() {
let error = null; let error = null;
if (this.state.errorText) { if (this.state.errorText) {
error = <div className="error">{this.state.errorText}</div>; error = <div className="error">{this.state.errorText}</div>;

View file

@ -53,7 +53,7 @@ interface IState {
} }
export default class CountryDropdown extends React.Component<IProps, IState> { export default class CountryDropdown extends React.Component<IProps, IState> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0]; let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0];

View file

@ -39,7 +39,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
} }
class EmailField extends PureComponent<IProps> { class EmailField extends PureComponent<IProps> {
static defaultProps = { public static defaultProps = {
label: _td("Email"), label: _td("Email"),
labelRequired: _td("Enter email address"), labelRequired: _td("Enter email address"),
labelInvalid: _td("Doesn't look like a valid email address"), labelInvalid: _td("Doesn't look like a valid email address"),
@ -60,7 +60,7 @@ class EmailField extends PureComponent<IProps> {
], ],
}); });
onValidate = async (fieldState: IFieldState) => { public onValidate = async (fieldState: IFieldState) => {
let validate = this.validate; let validate = this.validate;
if (this.props.validationRules) { if (this.props.validationRules) {
validate = this.props.validationRules; validate = this.props.validationRules;
@ -74,7 +74,7 @@ class EmailField extends PureComponent<IProps> {
return result; return result;
}; };
render() { public render() {
return ( return (
<Field <Field
id={this.props.id} id={this.props.id}

View file

@ -98,9 +98,9 @@ interface IPasswordAuthEntryState {
} }
export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswordAuthEntryState> { export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswordAuthEntryState> {
static LOGIN_TYPE = AuthType.Password; public static LOGIN_TYPE = AuthType.Password;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -108,7 +108,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
} }
@ -136,7 +136,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
}); });
}; };
render() { public render() {
const passwordBoxClass = classNames({ const passwordBoxClass = classNames({
error: this.props.errorText, error: this.props.errorText,
}); });
@ -194,9 +194,9 @@ interface IRecaptchaAuthEntryProps extends IAuthEntryProps {
/* eslint-enable camelcase */ /* eslint-enable camelcase */
export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps> { export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps> {
static LOGIN_TYPE = AuthType.Recaptcha; public static LOGIN_TYPE = AuthType.Recaptcha;
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
} }
@ -207,7 +207,7 @@ export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps
}); });
}; };
render() { public render() {
if (this.props.busy) { if (this.props.busy) {
return <Spinner />; return <Spinner />;
} }
@ -262,9 +262,9 @@ interface ITermsAuthEntryState {
} }
export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITermsAuthEntryState> { export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITermsAuthEntryState> {
static LOGIN_TYPE = AuthType.Terms; public static LOGIN_TYPE = AuthType.Terms;
constructor(props) { public constructor(props) {
super(props); super(props);
// example stageParams: // example stageParams:
@ -320,7 +320,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
} }
@ -349,7 +349,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
} }
}; };
render() { public render() {
if (this.props.busy) { if (this.props.busy) {
return <Spinner />; return <Spinner />;
} }
@ -423,9 +423,9 @@ export class EmailIdentityAuthEntry extends React.Component<
IEmailIdentityAuthEntryProps, IEmailIdentityAuthEntryProps,
IEmailIdentityAuthEntryState IEmailIdentityAuthEntryState
> { > {
static LOGIN_TYPE = AuthType.Email; public static LOGIN_TYPE = AuthType.Email;
constructor(props: IEmailIdentityAuthEntryProps) { public constructor(props: IEmailIdentityAuthEntryProps) {
super(props); super(props);
this.state = { this.state = {
@ -434,11 +434,11 @@ export class EmailIdentityAuthEntry extends React.Component<
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
} }
render() { public render() {
let errorSection; let errorSection;
// ignore the error when errcode is M_UNAUTHORIZED as we expect that error until the link is clicked. // 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") { if (this.props.errorText && this.props.errorCode !== "M_UNAUTHORIZED") {
@ -549,13 +549,13 @@ interface IMsisdnAuthEntryState {
} }
export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsisdnAuthEntryState> { export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsisdnAuthEntryState> {
static LOGIN_TYPE = AuthType.Msisdn; public static LOGIN_TYPE = AuthType.Msisdn;
private submitUrl: string; private submitUrl: string;
private sid: string; private sid: string;
private msisdn: string; private msisdn: string;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -565,7 +565,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
this.setState({ requestingToken: true }); this.setState({ requestingToken: true });
@ -646,7 +646,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
} }
}; };
render() { public render() {
if (this.state.requestingToken) { if (this.state.requestingToken) {
return <Spinner />; return <Spinner />;
} else { } else {
@ -704,16 +704,16 @@ interface ISSOAuthEntryState {
} }
export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEntryState> { export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEntryState> {
static LOGIN_TYPE = AuthType.Sso; public static LOGIN_TYPE = AuthType.Sso;
static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable; public static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable;
static PHASE_PREAUTH = 1; // button to start SSO public static PHASE_PREAUTH = 1; // button to start SSO
static PHASE_POSTAUTH = 2; // button to confirm SSO completed public static PHASE_POSTAUTH = 2; // button to confirm SSO completed
private ssoUrl: string; private ssoUrl: string;
private popupWindow: Window; private popupWindow: Window;
constructor(props) { public constructor(props) {
super(props); super(props);
// We actually send the user through fallback auth so we don't have to // We actually send the user through fallback auth so we don't have to
@ -729,11 +729,11 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
}; };
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH); this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH);
} }
componentWillUnmount() { public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage); window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) { if (this.popupWindow) {
this.popupWindow.close(); this.popupWindow.close();
@ -770,7 +770,7 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
this.props.submitAuthDict({}); this.props.submitAuthDict({});
}; };
render() { public render() {
let continueButton = null; let continueButton = null;
const cancelButton = ( const cancelButton = (
<AccessibleButton <AccessibleButton
@ -825,7 +825,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
private popupWindow: Window; private popupWindow: Window;
private fallbackButton = createRef<HTMLButtonElement>(); private fallbackButton = createRef<HTMLButtonElement>();
constructor(props) { public constructor(props) {
super(props); super(props);
// we have to make the user click a button, as browsers will block // we have to make the user click a button, as browsers will block
@ -834,11 +834,11 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
window.addEventListener("message", this.onReceiveMessage); window.addEventListener("message", this.onReceiveMessage);
} }
componentDidMount() { public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE); this.props.onPhaseChange(DEFAULT_PHASE);
} }
componentWillUnmount() { public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage); window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) { if (this.popupWindow) {
this.popupWindow.close(); this.popupWindow.close();
@ -865,7 +865,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
} }
}; };
render() { public render() {
let errorSection; let errorSection;
if (this.props.errorText) { if (this.props.errorText) {
errorSection = ( errorSection = (

View file

@ -35,7 +35,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
} }
class PassphraseConfirmField extends PureComponent<IProps> { class PassphraseConfirmField extends PureComponent<IProps> {
static defaultProps = { public static defaultProps = {
label: _td("Confirm password"), label: _td("Confirm password"),
labelRequired: _td("Confirm password"), labelRequired: _td("Confirm password"),
labelInvalid: _td("Passwords don't match"), labelInvalid: _td("Passwords don't match"),
@ -65,7 +65,7 @@ class PassphraseConfirmField extends PureComponent<IProps> {
return result; return result;
}; };
render() { public render() {
return ( return (
<Field <Field
id={this.props.id} id={this.props.id}

View file

@ -41,7 +41,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
} }
class PassphraseField extends PureComponent<IProps> { class PassphraseField extends PureComponent<IProps> {
static defaultProps = { public static defaultProps = {
label: _td("Password"), label: _td("Password"),
labelEnterPassword: _td("Enter password"), labelEnterPassword: _td("Enter password"),
labelStrongPassword: _td("Nice, strong password!"), labelStrongPassword: _td("Nice, strong password!"),
@ -94,7 +94,7 @@ class PassphraseField extends PureComponent<IProps> {
], ],
}); });
onValidate = async (fieldState: IFieldState) => { public onValidate = async (fieldState: IFieldState) => {
const result = await this.validate(fieldState); const result = await this.validate(fieldState);
if (this.props.onValidate) { if (this.props.onValidate) {
this.props.onValidate(result); this.props.onValidate(result);
@ -102,7 +102,7 @@ class PassphraseField extends PureComponent<IProps> {
return result; return result;
}; };
render() { public render() {
return ( return (
<Field <Field
id={this.props.id} id={this.props.id}

View file

@ -66,7 +66,7 @@ enum LoginField {
* The email/username/phone fields are fully-controlled, the password field is not. * The email/username/phone fields are fully-controlled, the password field is not.
*/ */
export default class PasswordLogin extends React.PureComponent<IProps, IState> { export default class PasswordLogin extends React.PureComponent<IProps, IState> {
static defaultProps = { public static defaultProps = {
onUsernameChanged: function () {}, onUsernameChanged: function () {},
onUsernameBlur: function () {}, onUsernameBlur: function () {},
onPhoneCountryChanged: function () {}, onPhoneCountryChanged: function () {},
@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
disableSubmit: false, disableSubmit: false,
}; };
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
// Field error codes by field ID // Field error codes by field ID
@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
} }
} }
render() { public render() {
let forgotPasswordJsx; let forgotPasswordJsx;
if (this.props.onForgotPasswordClick) { if (this.props.onForgotPasswordClick) {

View file

@ -95,12 +95,12 @@ interface IState {
* A pure UI component which displays a registration form. * A pure UI component which displays a registration form.
*/ */
export default class RegistrationForm extends React.PureComponent<IProps, IState> { export default class RegistrationForm extends React.PureComponent<IProps, IState> {
static defaultProps = { public static defaultProps = {
onValidationChange: logger.error, onValidationChange: logger.error,
canSubmit: true, canSubmit: true,
}; };
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -468,7 +468,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
); );
} }
renderPasswordConfirm() { public renderPasswordConfirm() {
return ( return (
<PassphraseConfirmField <PassphraseConfirmField
id="mx_RegistrationForm_passwordConfirm" id="mx_RegistrationForm_passwordConfirm"
@ -482,7 +482,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
); );
} }
renderPhoneNumber() { public renderPhoneNumber() {
if (!this.showPhoneNumber()) { if (!this.showPhoneNumber()) {
return null; return null;
} }
@ -508,7 +508,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
); );
} }
renderUsername() { public renderUsername() {
return ( return (
<Field <Field
id="mx_RegistrationForm_username" id="mx_RegistrationForm_username"
@ -524,7 +524,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
); );
} }
render() { public render() {
const registerButton = ( const registerButton = (
<input className="mx_Login_submit" type="submit" value={_t("Register")} disabled={!this.props.canSubmit} /> <input className="mx_Login_submit" type="submit" value={_t("Register")} disabled={!this.props.canSubmit} />
); );

View file

@ -82,7 +82,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
private isUnmounted = false; private isUnmounted = false;
private isWatchingTimeline = false; private isWatchingTimeline = false;
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -54,7 +54,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
oobData: {}, oobData: {},
}; };
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -34,7 +34,7 @@ interface IState {
export default class DialpadContextMenu extends React.Component<IProps, IState> { export default class DialpadContextMenu extends React.Component<IProps, IState> {
private numberEntryFieldRef: React.RefObject<Field> = createRef(); private numberEntryFieldRef: React.RefObject<Field> = createRef();
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -42,7 +42,7 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
}; };
} }
onDigitPress = (digit: string, ev: ButtonEvent) => { public onDigitPress = (digit: string, ev: ButtonEvent) => {
this.props.call.sendDtmfDigit(digit); this.props.call.sendDtmfDigit(digit);
this.setState({ value: this.state.value + digit }); this.setState({ value: this.state.value + digit });
@ -54,22 +54,22 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
} }
}; };
onCancelClick = () => { public onCancelClick = () => {
this.props.onFinished(); this.props.onFinished();
}; };
onKeyDown = (ev) => { public onKeyDown = (ev) => {
// Prevent Backspace and Delete keys from functioning in the entry field // Prevent Backspace and Delete keys from functioning in the entry field
if (ev.code === "Backspace" || ev.code === "Delete") { if (ev.code === "Backspace" || ev.code === "Delete") {
ev.preventDefault(); ev.preventDefault();
} }
}; };
onChange = (ev) => { public onChange = (ev) => {
this.setState({ value: ev.target.value }); this.setState({ value: ev.target.value });
}; };
render() { public render() {
return ( return (
<ContextMenu {...this.props}> <ContextMenu {...this.props}>
<div className="mx_DialPadContextMenuWrapper"> <div className="mx_DialPadContextMenuWrapper">

View file

@ -29,7 +29,7 @@ interface IProps {
* menu. * menu.
*/ */
export default class GenericElementContextMenu extends React.Component<IProps> { export default class GenericElementContextMenu extends React.Component<IProps> {
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
} }

View file

@ -26,27 +26,27 @@ interface IProps extends IContextMenuProps {
} }
export default class LegacyCallContextMenu extends React.Component<IProps> { export default class LegacyCallContextMenu extends React.Component<IProps> {
constructor(props) { public constructor(props) {
super(props); super(props);
} }
onHoldClick = () => { public onHoldClick = () => {
this.props.call.setRemoteOnHold(true); this.props.call.setRemoteOnHold(true);
this.props.onFinished(); this.props.onFinished();
}; };
onUnholdClick = () => { public onUnholdClick = () => {
LegacyCallHandler.instance.setActiveCallRoomId(this.props.call.roomId); LegacyCallHandler.instance.setActiveCallRoomId(this.props.call.roomId);
this.props.onFinished(); this.props.onFinished();
}; };
onTransferClick = () => { public onTransferClick = () => {
LegacyCallHandler.instance.showTransferDialog(this.props.call); LegacyCallHandler.instance.showTransferDialog(this.props.call);
this.props.onFinished(); this.props.onFinished();
}; };
render() { public render() {
const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold"); const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold");
const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick; const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick;

View file

@ -135,12 +135,12 @@ interface IState {
} }
export default class MessageContextMenu extends React.Component<IProps, IState> { export default class MessageContextMenu extends React.Component<IProps, IState> {
static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
private reactButtonRef = createRef<any>(); // XXX Ref to a functional component private reactButtonRef = createRef<any>(); // XXX Ref to a functional component
constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {

View file

@ -88,7 +88,7 @@ export default class BaseDialog extends React.Component<IProps> {
fixedWidth: true, fixedWidth: true,
}; };
constructor(props) { public constructor(props) {
super(props); super(props);
this.matrixClient = MatrixClientPeg.get(); this.matrixClient = MatrixClientPeg.get();

View file

@ -54,7 +54,7 @@ interface IState {
export default class BugReportDialog extends React.Component<IProps, IState> { export default class BugReportDialog extends React.Component<IProps, IState> {
private unmounted: boolean; private unmounted: boolean;
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
sendLogs: true, sendLogs: true,

View file

@ -30,7 +30,7 @@ interface IProps {
const REPOS = ["vector-im/element-web", "matrix-org/matrix-react-sdk", "matrix-org/matrix-js-sdk"]; const REPOS = ["vector-im/element-web", "matrix-org/matrix-react-sdk", "matrix-org/matrix-js-sdk"];
export default class ChangelogDialog extends React.Component<IProps> { export default class ChangelogDialog extends React.Component<IProps> {
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = {}; this.state = {};

View file

@ -45,7 +45,7 @@ interface IState {
* To avoid this, we keep the dialog open as long as /redact is in progress. * To avoid this, we keep the dialog open as long as /redact is in progress.
*/ */
export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IProps, IState> { export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IProps, IState> {
constructor(props) { public constructor(props) {
super(props); super(props);
this.state = { this.state = {
isRedacting: false, isRedacting: false,

View file

@ -31,7 +31,7 @@ interface IProps {
* A dialog for confirming a redaction. * A dialog for confirming a redaction.
*/ */
export default class ConfirmRedactDialog extends React.Component<IProps> { export default class ConfirmRedactDialog extends React.Component<IProps> {
render() { public render() {
return ( return (
<TextInputDialog <TextInputDialog
onFinished={this.props.onFinished} onFinished={this.props.onFinished}

Some files were not shown because too many files have changed in this diff Show more