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

@ -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>> {
static defaultProps = {
public static defaultProps = {
element: "div" as keyof ReactHTML,
};

View file

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

View file

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

View file

@ -51,7 +51,7 @@ interface IState {
* Component which shows the filtered file using a TimelinePanel
*/
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
// added to the timeline.
@ -59,7 +59,7 @@ class FilePanel extends React.Component<IProps, IState> {
public noRoom: boolean;
private card = createRef<HTMLDivElement>();
state = {
public state = {
timelineSet: null,
narrow: false,
};

View file

@ -22,7 +22,7 @@ interface IProps {
}
export default class GenericErrorPage extends React.PureComponent<IProps> {
render() {
public render() {
return (
<div className="mx_GenericErrorPage">
<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 checkAgainForTrackpad = 0; // ts in milliseconds to recheck this._likelyTrackpadUser
constructor(props: IProps<T>) {
public constructor(props: IProps<T>) {
super(props);
this.state = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -214,10 +214,10 @@ interface IReadReceiptForUser {
/* (almost) stateless UI component which builds the event tiles in the room timeline.
*/
export default class MessagePanel extends React.Component<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
static defaultProps = {
public static defaultProps = {
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.
public grouperKeyMap = new WeakMap<MatrixEvent, string>();
constructor(props, context) {
public constructor(props, context) {
super(props, context);
this.state = {
@ -296,19 +296,19 @@ export default class MessagePanel extends React.Component<IProps, IState> {
);
}
componentDidMount() {
public componentDidMount() {
this.calculateRoomMembersCount();
this.props.room?.currentState.on(RoomStateEvent.Update, this.calculateRoomMembersCount);
this.isMounted = true;
}
componentWillUnmount() {
public componentWillUnmount() {
this.isMounted = false;
this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount);
SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef);
}
componentDidUpdate(prevProps, prevState) {
public componentDidUpdate(prevProps, prevState) {
if (prevProps.layout !== this.props.layout) {
this.calculateRoomMembersCount();
}
@ -982,7 +982,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
}
}
render() {
public render() {
let topSpinner;
let bottomSpinner;
if (this.props.backPaginating) {
@ -1057,14 +1057,14 @@ export default class MessagePanel extends React.Component<IProps, IState> {
}
abstract class BaseGrouper {
static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true;
public static canStartGroup = (panel: MessagePanel, ev: MatrixEvent): boolean => true;
public events: MatrixEvent[] = [];
// events that we include in the group but then eject out and place above the group.
public ejectedEvents: MatrixEvent[] = [];
public readMarker: ReactNode;
constructor(
public constructor(
public readonly panel: MessagePanel,
public readonly event: MatrixEvent,
public readonly prevEvent: MatrixEvent,
@ -1097,7 +1097,7 @@ abstract class BaseGrouper {
// Grouping only events sent by the same user that sent the `m.room.create` and only until
// the first non-state event, beacon_info event or membership event which is not regarding the sender of the `m.room.create` event
class CreationGrouper extends BaseGrouper {
static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean {
public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean {
return ev.getType() === EventType.RoomCreate;
};
@ -1231,7 +1231,7 @@ class CreationGrouper extends BaseGrouper {
// Wrap consecutive grouped events in a ListSummary
class MainGrouper extends BaseGrouper {
static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean {
public static canStartGroup = function (panel: MessagePanel, ev: MatrixEvent): boolean {
if (!panel.shouldShowEvent(ev)) return false;
if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) {
@ -1249,7 +1249,7 @@ class MainGrouper extends BaseGrouper {
return false;
};
constructor(
public constructor(
public readonly panel: MessagePanel,
public readonly event: MatrixEvent,
public readonly prevEvent: MatrixEvent,

View file

@ -38,11 +38,11 @@ interface IState {
* Component which shows the global notification list using a TimelinePanel
*/
export default class NotificationPanel extends React.PureComponent<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
private card = React.createRef<HTMLDivElement>();
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -54,7 +54,7 @@ export default class NotificationPanel extends React.PureComponent<IProps, IStat
this.setState({ narrow });
};
render() {
public render() {
const emptyState = (
<div className="mx_RightPanel_empty mx_NotificationPanel_empty">
<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> {
static contextType = MatrixClientContext;
public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>;
constructor(props, context) {
public constructor(props, context) {
super(props, context);
this.state = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -611,13 +611,13 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
};
export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
static contextType = MatrixClientContext;
public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>;
private readonly creator: 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);
let phase = Phase.Landing;
@ -642,11 +642,11 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
}
componentDidMount() {
public componentDidMount() {
this.context.on(RoomEvent.MyMembership, this.onMyMembership);
}
componentWillUnmount() {
public componentWillUnmount() {
defaultDispatcher.unregister(this.dispatcherRef);
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
this.context.off(RoomEvent.MyMembership, this.onMyMembership);
@ -794,7 +794,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
}
}
render() {
public render() {
const rightPanel =
this.state.showRightPanel && this.state.phase === Phase.Landing ? (
<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 {string} screenName The screen name to report to Posthog.
*/
constructor(
public constructor(
public readonly id: string,
public readonly label: string,
public readonly icon: string,
@ -64,7 +64,7 @@ interface IState {
}
export default class TabbedView extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId);
@ -73,7 +73,7 @@ export default class TabbedView extends React.Component<IProps, IState> {
};
}
static defaultProps = {
public static defaultProps = {
tabLocation: TabLocation.LEFT,
};

View file

@ -76,7 +76,7 @@ interface IState {
}
export default class ThreadView extends React.Component<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
private dispatcherRef: string;
@ -84,7 +84,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
private timelinePanel = createRef<TimelinePanel>();
private card = createRef<HTMLDivElement>();
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
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.
*/
class TimelinePanel extends React.Component<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
// 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
// event tile heights. (See _unpaginateEvents)
timelineCap: Number.MAX_VALUE,
@ -257,7 +257,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// A map of <callId, 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);
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
// 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);
}
render() {
public render() {
// just show a spinner while the timeline loads.
//
// 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> {
constructor(props, context) {
public constructor(props, context) {
super(props, context);
this.state = {
toasts: ToastStore.sharedInstance().getToasts(),
@ -39,7 +39,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
ToastStore.sharedInstance().on("update", this.onToastStoreUpdate);
}
componentWillUnmount() {
public componentWillUnmount() {
ToastStore.sharedInstance().removeListener("update", this.onToastStoreUpdate);
}
@ -50,7 +50,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
});
};
render() {
public render() {
const totalCount = this.state.toasts.length;
const isStacked = totalCount > 1;
let toast;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -350,7 +350,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
} as any);
};
renderEnterEmail(): JSX.Element {
public renderEnterEmail(): JSX.Element {
return (
<EnterEmail
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, {
title: _t("Warning!"),
description: (
@ -395,7 +395,7 @@ export default class ForgotPassword extends React.Component<Props, State> {
return confirmed;
}
renderCheckEmail(): JSX.Element {
public renderCheckEmail(): JSX.Element {
return (
<CheckEmail
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 =
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 (
<>
<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;
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>;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -148,7 +148,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
this.initLoginLogic(this.props.serverConfig);
}
componentWillUnmount() {
public componentWillUnmount() {
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) {
this.setState({ busy: true });
// 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 });
};
onUsernameBlur = async (username) => {
public onUsernameBlur = async (username) => {
const doWellknownLookup = username[0] === "@";
this.setState({
username: username,
@ -315,23 +315,23 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
}
};
onPhoneCountryChanged = (phoneCountry) => {
public onPhoneCountryChanged = (phoneCountry) => {
this.setState({ phoneCountry: phoneCountry });
};
onPhoneNumberChanged = (phoneNumber) => {
public onPhoneNumberChanged = (phoneNumber) => {
this.setState({
phoneNumber: phoneNumber,
});
};
onRegisterClick = (ev) => {
public onRegisterClick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
this.props.onRegisterClick();
};
onTryRegisterClick = (ev) => {
public onTryRegisterClick = (ev) => {
const hasPasswordFlow = this.state.flows?.find((flow) => flow.type === "m.login.password");
const ssoFlow = this.state.flows?.find((flow) => flow.type === "m.login.sso" || flow.type === "m.login.cas");
// If has no password flow but an SSO flow guess that the user wants to register with SSO.
@ -502,7 +502,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
return errorText;
}
renderLoginComponentForFlows() {
public renderLoginComponentForFlows() {
if (!this.state.flows) return null;
// this is the ideal order we want to show the flows in
@ -553,7 +553,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
);
};
render() {
public render() {
const loader =
this.isBusy() && !this.state.busyLoggingIn ? (
<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
private latestServerConfig: ValidatedServerConfig;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -148,13 +148,13 @@ export default class Registration extends React.Component<IProps, IState> {
});
}
componentDidMount() {
public componentDidMount() {
this.replaceClient(this.props.serverConfig);
//triggers a confirmation dialog for data loss before page unloads/refreshes
window.addEventListener("beforeunload", this.unloadCallback);
}
componentWillUnmount() {
public componentWillUnmount() {
window.removeEventListener("beforeunload", this.unloadCallback);
}
@ -565,7 +565,7 @@ export default class Registration extends React.Component<IProps, IState> {
}
}
render() {
public render() {
let errorText;
const err = this.state.errorText;
if (err) {

View file

@ -45,7 +45,7 @@ interface IState {
}
export default class SetupEncryptionBody extends React.Component<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
const store = SetupEncryptionStore.sharedInstance();
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 playPauseRef: RefObject<PlayPauseButton> = createRef();
constructor(props: T) {
public constructor(props: T) {
super(props);
// 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()),
);
constructor(props) {
public constructor(props) {
super(props);
this.state = {
seconds: 0,
};
}
componentDidMount() {
public componentDidMount() {
this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => {
this.seconds = update.timeSeconds;
this.scheduledUpdate.mark();

View file

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

View file

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

View file

@ -34,14 +34,14 @@ interface ICaptchaFormState {
* A pure UI component which displays a captcha form.
*/
export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICaptchaFormState> {
static defaultProps = {
public static defaultProps = {
onCaptchaResponse: () => {},
};
private captchaWidgetId?: string;
private recaptchaContainer = createRef<HTMLDivElement>();
constructor(props: ICaptchaFormProps) {
public constructor(props: ICaptchaFormProps) {
super(props);
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,
// so we do this instead.
if (this.isRecaptchaReady()) {
@ -69,7 +69,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
componentWillUnmount() {
public componentWillUnmount() {
this.resetRecaptcha();
}
@ -122,7 +122,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
render() {
public render() {
let error = null;
if (this.state.errorText) {
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> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0];

View file

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

View file

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

View file

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

View file

@ -41,7 +41,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class PassphraseField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Password"),
labelEnterPassword: _td("Enter password"),
labelStrongPassword: _td("Nice, strong password!"),
@ -94,7 +94,7 @@ class PassphraseField extends PureComponent<IProps> {
],
});
onValidate = async (fieldState: IFieldState) => {
public onValidate = async (fieldState: IFieldState) => {
const result = await this.validate(fieldState);
if (this.props.onValidate) {
this.props.onValidate(result);
@ -102,7 +102,7 @@ class PassphraseField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
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.
*/
export default class PasswordLogin extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onUsernameChanged: function () {},
onUsernameBlur: function () {},
onPhoneCountryChanged: function () {},
@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
disableSubmit: false,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// Field error codes by field ID
@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
}
}
render() {
public render() {
let forgotPasswordJsx;
if (this.props.onForgotPasswordClick) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -54,7 +54,7 @@ interface IState {
export default class BugReportDialog extends React.Component<IProps, IState> {
private unmounted: boolean;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
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"];
export default class ChangelogDialog extends React.Component<IProps> {
constructor(props) {
public constructor(props) {
super(props);
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.
*/
export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
isRedacting: false,

View file

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

View file

@ -55,12 +55,12 @@ interface IState {
* Also tweaks the style for 'dangerous' actions (albeit only with colour)
*/
export default class ConfirmUserActionDialog extends React.Component<IProps, IState> {
static defaultProps = {
public static defaultProps = {
danger: false,
askReason: false,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -33,7 +33,7 @@ export default class ConfirmWipeDeviceDialog extends React.Component<IProps> {
this.props.onFinished(false);
};
render() {
public render() {
return (
<BaseDialog
className="mx_ConfirmWipeDeviceDialog"

View file

@ -62,7 +62,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
private nameField = createRef<Field>();
private aliasField = createRef<RoomAliasField>();
constructor(props) {
public constructor(props) {
super(props);
this.supportsRestricted = !!this.props.parentSpace;
@ -124,7 +124,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
return opts;
}
componentDidMount() {
public componentDidMount() {
// move focus to first field when showing dialog
this.nameField.current.focus();
}
@ -216,7 +216,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
],
});
render() {
public render() {
const isVideoRoom = this.props.type === RoomType.ElementVideo;
let aliasField: JSX.Element;

View file

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

View file

@ -59,7 +59,7 @@ export default class EndPollDialog extends React.Component<IProps> {
this.props.onFinished(endPoll);
};
render() {
public render() {
return (
<QuestionDialog
title={_t("End Poll")}

View file

@ -42,7 +42,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
private iframeRef: React.RefObject<HTMLIFrameElement> = React.createRef();
private readonly config: SnakedObject<IConfigOptions["host_signup"]>;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -56,7 +56,7 @@ interface IState {
export default class IncomingSasDialog extends React.Component<IProps, IState> {
private showSasEvent: ISasEvent;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let phase = PHASE_START;

View file

@ -34,7 +34,7 @@ interface IProps extends IDialogProps {
}
export default class InfoDialog extends React.Component<IProps> {
static defaultProps = {
public static defaultProps = {
title: "",
description: "",
hasCloseButton: false,
@ -44,7 +44,7 @@ export default class InfoDialog extends React.Component<IProps> {
this.props.onFinished();
};
render() {
public render() {
return (
<BaseDialog
className="mx_InfoDialog"

View file

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

View file

@ -100,7 +100,7 @@ class DMUserTile extends React.PureComponent<IDMUserTileProps> {
this.props.onRemove(this.props.member);
};
render() {
public render() {
const avatarSize = 20;
const avatar = <SearchResultAvatar user={this.props.member} size={avatarSize} />;
@ -187,7 +187,7 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
return result;
}
render() {
public render() {
let timestamp = null;
if (this.props.lastActiveTs) {
const humanTs = humanizeTime(this.props.lastActiveTs);
@ -301,7 +301,7 @@ interface IInviteDialogState {
}
export default class InviteDialog extends React.PureComponent<Props, IInviteDialogState> {
static defaultProps = {
public static defaultProps = {
kind: KIND_DM,
initialText: "",
};
@ -311,7 +311,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
private numberEntryFieldRef: React.RefObject<Field> = createRef();
private unmounted = false;
constructor(props) {
public constructor(props) {
super(props);
if (props.kind === KIND_INVITE && !props.roomId) {
@ -351,13 +351,13 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
};
}
componentDidMount() {
public componentDidMount() {
if (this.props.initialText) {
this.updateSuggestions(this.props.initialText);
}
}
componentWillUnmount() {
public componentWillUnmount() {
this.unmounted = true;
}
@ -1078,7 +1078,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
}
}
render() {
public render() {
let spinner = null;
if (this.state.busy) {
spinner = <Spinner w={20} h={20} />;

View file

@ -41,11 +41,11 @@ interface IState {
}
export default class LogoutDialog extends React.Component<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onFinished: function () {},
};
constructor(props) {
public constructor(props) {
super(props);
const cli = MatrixClientPeg.get();
@ -127,7 +127,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
this.props.onFinished(true);
};
render() {
public render() {
if (this.state.shouldLoadBackupStatus) {
const description = (
<div>

View file

@ -48,7 +48,7 @@ interface IState {
}
export default class MessageEditHistoryDialog extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
originalEvent: null,

View file

@ -61,11 +61,11 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
private readonly possibleButtons: ModalButtonID[];
private appFrame: React.RefObject<HTMLIFrameElement> = React.createRef();
state: IState = {
public state: IState = {
disabledButtonIds: (this.props.widgetDefinition.buttons || []).filter((b) => b.disabled).map((b) => b.id),
};
constructor(props) {
public constructor(props) {
super(props);
this.widget = new ElementWidget({

View file

@ -96,7 +96,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
// If the room supports moderation, the moderation information.
private moderation?: Moderation;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let moderatedByRoomId = null;

View file

@ -55,7 +55,7 @@ interface IState {
export default class RoomSettingsDialog extends React.Component<IProps, IState> {
private dispatcherRef: string;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = { roomName: "" };
}
@ -180,7 +180,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
return tabs;
}
render() {
public render() {
const roomName = this.state.roomName;
return (
<BaseDialog

View file

@ -37,11 +37,11 @@ interface IState {
export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
private targetVersion: string;
state = {
public state = {
busy: true,
};
async componentDidMount() {
public async componentDidMount() {
const recommended = await this.props.room.getRecommendedVersion();
this.targetVersion = recommended.version;
this.setState({ busy: false });
@ -68,7 +68,7 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
});
};
render() {
public render() {
let buttons;
if (this.state.busy) {
buttons = <Spinner />;

View file

@ -53,7 +53,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
private readonly isPrivate: boolean;
private readonly currentVersion: string;
constructor(props) {
public constructor(props) {
super(props);
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
@ -100,7 +100,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
Modal.createDialog(BugReportDialog, {});
};
render() {
public render() {
const brand = SdkConfig.get().brand;
let inviteToggle = null;

View file

@ -45,7 +45,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
private readonly fieldRef = createRef<Field>();
private validatedConf: ValidatedServerConfig;
constructor(props) {
public constructor(props) {
super(props);
const config = SdkConfig.get();

View file

@ -22,7 +22,7 @@ import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
export default class SeshatResetDialog extends React.PureComponent<IDialogProps> {
render() {
public render() {
return (
<BaseDialog
hasCancel={true}

View file

@ -46,7 +46,7 @@ interface IState {
export default class SetEmailDialog extends React.Component<IProps, IState> {
private addThreepid: AddThreepid;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -75,7 +75,7 @@ interface IState {
}
export default class ShareDialog extends React.PureComponent<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
let permalinkCreator: RoomPermalinkCreator = null;
@ -91,7 +91,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
};
}
static onLinkClick(e) {
public static onLinkClick(e) {
e.preventDefault();
selectText(e.target);
}
@ -124,7 +124,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
return matrixToUrl;
}
render() {
public render() {
let title;
let checkbox;

View file

@ -33,7 +33,7 @@ class TermsCheckbox extends React.PureComponent<ITermsCheckboxProps> {
this.props.onChange(this.props.url, ev.currentTarget.checked);
};
render() {
public render() {
return <input type="checkbox" onChange={this.onChange} checked={this.props.checked} />;
}
}
@ -63,7 +63,7 @@ interface IState {
}
export default class TermsDialog extends React.PureComponent<ITermsDialogProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// url -> boolean

View file

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

View file

@ -35,11 +35,11 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
private readonly objectUrl: string;
private readonly mimeType: string;
static defaultProps = {
public static defaultProps = {
totalFiles: 1,
};
constructor(props) {
public constructor(props) {
super(props);
// Create a fresh `Blob` for previewing (even though `File` already is
@ -49,7 +49,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
this.objectUrl = URL.createObjectURL(blob);
}
componentWillUnmount() {
public componentWillUnmount() {
if (this.objectUrl) URL.revokeObjectURL(this.objectUrl);
}
@ -65,7 +65,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
this.props.onFinished(true, true);
};
render() {
public render() {
let title: string;
if (this.props.totalFiles > 1 && this.props.currentIndex !== undefined) {
title = _t("Upload files (%(current)s of %(total)s)", {

View file

@ -50,7 +50,7 @@ interface IState {
export default class UserSettingsDialog extends React.Component<IProps, IState> {
private settingsWatchers: string[] = [];
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -210,7 +210,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
return tabs;
}
render() {
public render() {
return (
<BaseDialog
className="mx_UserSettingsDialog"

View file

@ -35,7 +35,7 @@ interface IState {
}
export default class VerificationRequestDialog extends React.Component<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
verificationRequest: this.props.verificationRequest,
@ -47,7 +47,7 @@ export default class VerificationRequestDialog extends React.Component<IProps, I
}
}
render() {
public render() {
const request = this.state.verificationRequest;
const otherUserId = request && request.otherUserId;
const member = this.props.member || (otherUserId && MatrixClientPeg.get().getUser(otherUserId));

View file

@ -46,7 +46,7 @@ interface IState {
export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<IProps, IState> {
private eventPermissionsMap = new Map<Capability, WidgetEventCapability>();
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
const parsedEvents = WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities);

View file

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

View file

@ -62,7 +62,7 @@ interface IState {
export default class AccessSecretStorageDialog extends React.PureComponent<IProps, IState> {
private fileUpload = React.createRef<HTMLInputElement>();
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -268,7 +268,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
}
}
render() {
public render() {
const hasPassphrase =
this.props.keyInfo &&
this.props.keyInfo.passphrase &&

View file

@ -33,7 +33,7 @@ export default class ConfirmDestroyCrossSigningDialog extends React.Component<IP
this.props.onFinished(false);
};
render() {
public render() {
return (
<BaseDialog
className="mx_ConfirmDestroyCrossSigningDialog"

View file

@ -46,7 +46,7 @@ interface IState {
* may need to complete some steps to proceed.
*/
export default class CreateCrossSigningDialog extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -167,7 +167,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
this.props.onFinished(false);
};
render() {
public render() {
let content;
if (this.state.error) {
content = (

View file

@ -77,11 +77,11 @@ interface IState {
* Dialog for restoring e2e keys from a backup and the user's recovery key
*/
export default class RestoreKeyBackupDialog extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
showSummary: true,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
backupInfo: null,

View file

@ -38,7 +38,7 @@ interface IState {
export default class SetupEncryptionDialog extends React.Component<IProps, IState> {
private store: SetupEncryptionStore;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.store = SetupEncryptionStore.sharedInstance();

View file

@ -36,14 +36,14 @@ interface IState {
}
export default class AccessibleTooltipButton extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
hover: false,
};
}
componentDidUpdate(prevProps: Readonly<IProps>) {
public componentDidUpdate(prevProps: Readonly<IProps>) {
if (!prevProps.forceHide && this.props.forceHide && this.state.hover) {
this.setState({
hover: false,
@ -73,7 +73,7 @@ export default class AccessibleTooltipButton extends React.PureComponent<IProps,
if (ev.relatedTarget) this.showTooltip();
};
render() {
public render() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { title, tooltip, children, tooltipClassName, forceHide, alignment, onHideTooltip, ...props } =
this.props;

View file

@ -44,11 +44,11 @@ interface IState {
}
export default class AppPermission extends React.Component<IProps, IState> {
static defaultProps: Partial<IProps> = {
public static defaultProps: Partial<IProps> = {
onPermissionGranted: () => {},
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
// The first step is to pick apart the widget so we can render information about it
@ -88,7 +88,7 @@ export default class AppPermission extends React.Component<IProps, IState> {
}
}
render() {
public render() {
const brand = SdkConfig.get().brand;
const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId;

View file

@ -104,7 +104,7 @@ interface IState {
export default class AppTile extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext;
context: ContextType<typeof MatrixClientContext>;
public context: ContextType<typeof MatrixClientContext>;
public static defaultProps: Partial<IProps> = {
waitForIframeLoad: true,
@ -126,7 +126,7 @@ export default class AppTile extends React.Component<IProps, IState> {
private dispatcherRef: string;
private unmounted: boolean;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
// Tiles in miniMode are floating, and therefore not docked

View file

@ -47,7 +47,7 @@ export interface ExistingSourceIProps {
}
export class ExistingSource extends React.Component<ExistingSourceIProps> {
constructor(props: ExistingSourceIProps) {
public constructor(props: ExistingSourceIProps) {
super(props);
}
@ -55,7 +55,7 @@ export class ExistingSource extends React.Component<ExistingSourceIProps> {
this.props.onSelect(this.props.source);
};
render() {
public render() {
const thumbnailClasses = classNames({
mx_desktopCapturerSourcePicker_source_thumbnail: true,
mx_desktopCapturerSourcePicker_source_thumbnail_selected: this.props.selected,
@ -84,9 +84,9 @@ export interface PickerIProps {
}
export default class DesktopCapturerSourcePicker extends React.Component<PickerIProps, PickerIState> {
interval: number;
public interval: number;
constructor(props: PickerIProps) {
public constructor(props: PickerIProps) {
super(props);
this.state = {
@ -96,7 +96,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
};
}
async componentDidMount() {
public async componentDidMount() {
// window.setInterval() first waits and then executes, therefore
// we call getDesktopCapturerSources() here without any delay.
// Otherwise the dialog would be left empty for some time.
@ -112,7 +112,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
}, 500);
}
componentWillUnmount() {
public componentWillUnmount() {
clearInterval(this.interval);
}
@ -149,7 +149,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
return new Tab(type, label, null, <div className="mx_desktopCapturerSourcePicker_tab">{sources}</div>);
}
render() {
public render() {
const tabs = [
this.getTab("screen", _t("Share entire screen")),
this.getTab("window", _t("Application window")),

View file

@ -25,7 +25,7 @@ interface IProps {
}
export default class DialPadBackspaceButton extends React.PureComponent<IProps> {
render() {
public render() {
return (
<div className="mx_DialPadBackspaceButtonWrapper">
<AccessibleButton

View file

@ -34,7 +34,7 @@ export interface ILocationState {
}
export default class Draggable extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -73,7 +73,7 @@ export default class Draggable extends React.Component<IProps, IState> {
});
}
render() {
public render() {
return <div className={this.props.className} onMouseDown={this.onMouseDown} />;
}
}

View file

@ -35,7 +35,7 @@ interface IMenuOptionProps {
}
class MenuOption extends React.Component<IMenuOptionProps> {
static defaultProps = {
public static defaultProps = {
disabled: false,
};
@ -49,7 +49,7 @@ class MenuOption extends React.Component<IMenuOptionProps> {
this.props.onClick(this.props.dropdownKey);
};
render() {
public render() {
const optClasses = classnames({
mx_Dropdown_option: true,
mx_Dropdown_option_highlight: this.props.highlighted,
@ -117,7 +117,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
private ignoreEvent: MouseEvent = null;
private childrenByKey: Record<string, ReactNode> = {};
constructor(props: DropdownProps) {
public constructor(props: DropdownProps) {
super(props);
this.reindexChildren(this.props.children);
@ -149,7 +149,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
}
}
componentWillUnmount() {
public componentWillUnmount() {
document.removeEventListener("click", this.onDocumentClick, false);
}
@ -327,7 +327,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
return options;
}
render() {
public render() {
let currentValue;
const menuStyle: CSSProperties = {};

View file

@ -57,7 +57,7 @@ export class EditableItem extends React.Component<IItemProps, IItemState> {
this.setState({ verifyRemove: false });
};
render() {
public render() {
if (this.state.verifyRemove) {
return (
<div className="mx_EditableItem">
@ -148,7 +148,7 @@ export default class EditableItemList<P = {}> extends React.PureComponent<IProps
);
}
render() {
public render() {
const editableItems = this.props.items.map((item, index) => {
if (!this.props.canRemove) {
return <li key={item}>{item}</li>;

View file

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

View file

@ -66,7 +66,7 @@ export default class EditableTextContainer extends React.Component<IProps, IStat
},
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

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