Merge branch 'develop' into dbkr/email_phone_css_temporary_move

This commit is contained in:
David Baker 2024-08-01 17:38:42 +01:00 committed by GitHub
commit da67dbcc87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 86 additions and 148 deletions

View file

@ -10,15 +10,15 @@ module.exports = {
"last 2 Safari versions", "last 2 Safari versions",
"last 2 Edge versions", "last 2 Edge versions",
], ],
include: ["@babel/plugin-transform-class-properties"],
}, },
], ],
"@babel/preset-typescript", ["@babel/preset-typescript", { allowDeclareFields: true }],
"@babel/preset-react", "@babel/preset-react",
], ],
plugins: [ plugins: [
"@babel/plugin-proposal-export-default-from", "@babel/plugin-proposal-export-default-from",
"@babel/plugin-transform-numeric-separator", "@babel/plugin-transform-numeric-separator",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-object-rest-spread", "@babel/plugin-transform-object-rest-spread",
"@babel/plugin-syntax-dynamic-import", "@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime", "@babel/plugin-transform-runtime",

View file

@ -29,7 +29,6 @@ const dendriteConfigFile = "dendrite.yaml";
// Surprisingly, Dendrite implements the same register user Admin API Synapse, so we can just extend it // Surprisingly, Dendrite implements the same register user Admin API Synapse, so we can just extend it
export class Dendrite extends Synapse implements Homeserver, HomeserverInstance { export class Dendrite extends Synapse implements Homeserver, HomeserverInstance {
public config: HomeserverConfig & { serverId: string };
protected image = "matrixdotorg/dendrite-monolith:main"; protected image = "matrixdotorg/dendrite-monolith:main";
protected entrypoint = "/usr/bin/dendrite"; protected entrypoint = "/usr/bin/dendrite";

View file

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2018", "target": "es2022",
"jsx": "react", "jsx": "react",
"lib": ["ESNext", "es2021", "dom", "dom.iterable"], "lib": ["ESNext", "es2022", "dom", "dom.iterable"],
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node", "moduleResolution": "node",

View file

@ -144,69 +144,14 @@ declare global {
usageDetails?: { [key: string]: number }; usageDetails?: { [key: string]: number };
} }
// https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
interface OffscreenCanvas {
convertToBlob(opts?: { type?: string; quality?: number }): Promise<Blob>;
}
interface HTMLAudioElement {
type?: string;
}
interface HTMLVideoElement {
type?: string;
}
// Add Chrome-specific `instant` ScrollBehaviour
type _ScrollBehavior = ScrollBehavior | "instant";
interface _ScrollOptions {
behavior?: _ScrollBehavior;
}
interface _ScrollIntoViewOptions extends _ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface Element { interface Element {
// Safari & IE11 only have this prefixed: we used prefixed versions // Safari & IE11 only have this prefixed: we used prefixed versions
// previously so let's continue to support them for now // previously so let's continue to support them for now
webkitRequestFullScreen(options?: FullscreenOptions): Promise<void>; webkitRequestFullScreen(options?: FullscreenOptions): Promise<void>;
msRequestFullscreen(options?: FullscreenOptions): Promise<void>; msRequestFullscreen(options?: FullscreenOptions): Promise<void>;
scrollIntoView(arg?: boolean | _ScrollIntoViewOptions): void; // scrollIntoView(arg?: boolean | _ScrollIntoViewOptions): void;
} }
interface Error {
// Standard
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
cause?: unknown;
// Non-standard
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName
fileName?: string;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/lineNumber
lineNumber?: number;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/columnNumber
columnNumber?: number;
}
// We can remove these pieces if we ever update to `target: "es2022"` in our
// TypeScript config which supports the new `cause` property, see
// https://github.com/vector-im/element-web/issues/24913
interface ErrorOptions {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
cause?: unknown;
}
interface ErrorConstructor {
new (message?: string, options?: ErrorOptions): Error;
(message?: string, options?: ErrorOptions): Error;
}
// eslint-disable-next-line no-var
var Error: ErrorConstructor;
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278 // https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
interface AudioWorkletProcessor { interface AudioWorkletProcessor {
readonly port: MessagePort; readonly port: MessagePort;

View file

@ -45,7 +45,7 @@ interface IState {
export default class EmbeddedPage extends React.PureComponent<IProps, IState> { export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private unmounted = false; private unmounted = false;
private dispatcherRef: string | null = null; private dispatcherRef: string | null = null;

View file

@ -59,7 +59,7 @@ interface IState {
*/ */
class FilePanel extends React.Component<IProps, IState> { class FilePanel extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof 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.

View file

@ -205,7 +205,7 @@ interface IReadReceiptForUser {
*/ */
export default class MessagePanel extends React.Component<IProps, IState> { export default class MessagePanel extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public static defaultProps = { public static defaultProps = {
disableGrouping: false, disableGrouping: false,

View file

@ -42,7 +42,7 @@ interface IState {
*/ */
export default class NotificationPanel extends React.PureComponent<IProps, IState> { export default class NotificationPanel extends React.PureComponent<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private card = React.createRef<HTMLDivElement>(); private card = React.createRef<HTMLDivElement>();

View file

@ -73,7 +73,7 @@ interface IState {
export default class RightPanel extends React.Component<Props, IState> { export default class RightPanel extends React.Component<Props, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: Props, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: Props, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -97,11 +97,10 @@ interface IState {
export default class RoomStatusBar extends React.PureComponent<IProps, IState> { export default class RoomStatusBar extends React.PureComponent<IProps, IState> {
private unmounted = false; private unmounted = false;
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);
this.context = context; // XXX: workaround for lack of `declare` support on `public context!:` definition
this.state = { this.state = {
syncState: this.context.getSyncState(), syncState: this.context.getSyncState(),

View file

@ -417,7 +417,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
private roomViewBody = createRef<HTMLDivElement>(); private roomViewBody = createRef<HTMLDivElement>();
public static contextType = SDKContext; public static contextType = SDKContext;
public context!: React.ContextType<typeof SDKContext>; public declare context: React.ContextType<typeof SDKContext>;
public constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) { public constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) {
super(props, context); super(props, context);

View file

@ -605,7 +605,7 @@ const SpaceSetupPrivateInvite: React.FC<{
export default class SpaceRoomView extends React.PureComponent<IProps, IState> { export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private readonly dispatcherRef: string; private readonly dispatcherRef: string;

View file

@ -83,7 +83,7 @@ interface IState {
export default class ThreadView extends React.Component<IProps, IState> { export default class ThreadView extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private dispatcherRef: string | null = null; private dispatcherRef: string | null = null;
private readonly layoutWatcherRef: string; private readonly layoutWatcherRef: string;

View file

@ -241,7 +241,7 @@ interface IEventIndexOpts {
*/ */
class TimelinePanel extends React.Component<IProps, IState> { class TimelinePanel extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare 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
public static roomReadMarkerTsMap: Record<string, number> = {}; public static roomReadMarkerTsMap: Record<string, number> = {};
@ -273,7 +273,6 @@ class TimelinePanel extends React.Component<IProps, IState> {
public 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;
debuglog("mounting"); debuglog("mounting");

View file

@ -90,7 +90,7 @@ const below = (rect: PartialDOMRect): MenuProps => {
export default class UserMenu extends React.Component<IProps, IState> { export default class UserMenu extends React.Component<IProps, IState> {
public static contextType = SDKContext; public static contextType = SDKContext;
public context!: React.ContextType<typeof SDKContext>; public declare context: React.ContextType<typeof SDKContext>;
private dispatcherRef?: string; private dispatcherRef?: string;
private themeWatcherRef?: string; private themeWatcherRef?: string;
@ -100,7 +100,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) { public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
super(props, context); super(props, context);
this.context = context;
this.state = { this.state = {
contextMenuPosition: null, contextMenuPosition: null,
isDarkTheme: this.isUserOnDarkTheme(), isDarkTheme: this.isUserOnDarkTheme(),

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> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -72,13 +72,11 @@ interface IState {
export default class SoftLogout extends React.Component<IProps, IState> { export default class SoftLogout extends React.Component<IProps, IState> {
public static contextType = SDKContext; public static contextType = SDKContext;
public context!: React.ContextType<typeof SDKContext>; public declare context: React.ContextType<typeof SDKContext>;
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) { public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
super(props, context); super(props, context);
this.context = context;
this.state = { this.state = {
loginView: LoginView.Loading, loginView: LoginView.Loading,
busy: false, busy: false,

View file

@ -133,7 +133,7 @@ interface IState {
export default class MessageContextMenu extends React.Component<IProps, IState> { export default class MessageContextMenu extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare 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

View file

@ -120,7 +120,7 @@ interface IState {
export default class AppTile extends React.Component<IProps, IState> { export default class AppTile extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: ContextType<typeof MatrixClientContext>; public declare context: ContextType<typeof MatrixClientContext>;
public static defaultProps: Partial<IProps> = { public static defaultProps: Partial<IProps> = {
waitForIframeLoad: true, waitForIframeLoad: true,
@ -144,7 +144,6 @@ export default class AppTile extends React.Component<IProps, IState> {
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);
this.context = context; // XXX: workaround for lack of `declare` support on `public context!:` definition
// Tiles in miniMode are floating, and therefore not docked // Tiles in miniMode are floating, and therefore not docked
if (!this.props.miniMode) { if (!this.props.miniMode) {

View file

@ -81,7 +81,7 @@ export default class EventListSummary extends React.Component<
IProps & Required<Pick<IProps, "summaryLength" | "threshold" | "avatarsMaxLength" | "layout">> IProps & Required<Pick<IProps, "summaryLength" | "threshold" | "avatarsMaxLength" | "layout">>
> { > {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public static defaultProps = { public static defaultProps = {
summaryLength: 1, summaryLength: 1,

View file

@ -32,7 +32,7 @@ interface IProps {
export default class PersistentApp extends React.Component<IProps> { export default class PersistentApp extends React.Component<IProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: ContextType<typeof MatrixClientContext>; public declare context: ContextType<typeof MatrixClientContext>;
private room: Room; private room: Room;
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {

View file

@ -73,7 +73,7 @@ interface IState {
// be low as each event being loaded (after the first) is triggered by an explicit user action. // be low as each event being loaded (after the first) is triggered by an explicit user action.
export default class ReplyChain extends React.Component<IProps, IState> { export default class ReplyChain extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private unmounted = false; private unmounted = false;
private room: Room; private room: Room;

View file

@ -41,7 +41,7 @@ interface IState {
// Controlled form component wrapping Field for inputting a room alias scoped to a given domain // Controlled form component wrapping Field for inputting a room alias scoped to a given domain
export default class RoomAliasField extends React.PureComponent<IProps, IState> { export default class RoomAliasField extends React.PureComponent<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private fieldRef = createRef<Field>(); private fieldRef = createRef<Field>();

View file

@ -37,7 +37,7 @@ interface IState {
class ReactionPicker extends React.Component<IProps, IState> { class ReactionPicker extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context); super(props, context);

View file

@ -31,7 +31,7 @@ interface IProps {
class Search extends React.PureComponent<IProps> { class Search extends React.PureComponent<IProps> {
public static contextType = RovingTabIndexContext; public static contextType = RovingTabIndexContext;
public context!: React.ContextType<typeof RovingTabIndexContext>; public declare context: React.ContextType<typeof RovingTabIndexContext>;
private inputRef = React.createRef<HTMLInputElement>(); private inputRef = React.createRef<HTMLInputElement>();

View file

@ -50,7 +50,7 @@ const isSharingOwnLocation = (shareType: LocationShareType): boolean =>
class LocationPicker extends React.Component<ILocationPickerProps, IState> { class LocationPicker extends React.Component<ILocationPickerProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private map?: maplibregl.Map; private map?: maplibregl.Map;
private geolocate?: maplibregl.GeolocateControl; private geolocate?: maplibregl.GeolocateControl;
private marker?: maplibregl.Marker; private marker?: maplibregl.Marker;

View file

@ -52,7 +52,7 @@ interface IState {
export default class EditHistoryMessage extends React.PureComponent<IProps, IState> { export default class EditHistoryMessage extends React.PureComponent<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private content = createRef<HTMLDivElement>(); private content = createRef<HTMLDivElement>();
private pills: Element[] = []; private pills: Element[] = [];
@ -60,7 +60,6 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);
this.context = context;
const cli = this.context; const cli = this.context;
const userId = cli.getSafeUserId(); const userId = cli.getSafeUserId();

View file

@ -38,7 +38,7 @@ interface IState {
export default class MAudioBody extends React.PureComponent<IBodyProps, IState> { export default class MAudioBody extends React.PureComponent<IBodyProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public state: IState = {}; public state: IState = {};

View file

@ -106,7 +106,7 @@ interface IState {
export default class MFileBody extends React.Component<IProps, IState> { export default class MFileBody extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public state: IState = {}; public state: IState = {};

View file

@ -65,7 +65,7 @@ interface IState {
export default class MImageBody extends React.Component<IBodyProps, IState> { export default class MImageBody extends React.Component<IBodyProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private unmounted = true; private unmounted = true;
private image = createRef<HTMLImageElement>(); private image = createRef<HTMLImageElement>();

View file

@ -38,7 +38,7 @@ interface IState {
export default class MLocationBody extends React.Component<IBodyProps, IState> { export default class MLocationBody extends React.Component<IBodyProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private unmounted = false; private unmounted = false;
private mapId: string; private mapId: string;

View file

@ -147,7 +147,7 @@ export function launchPollEditor(mxEvent: MatrixEvent, getRelationsForEvent?: Ge
export default class MPollBody extends React.Component<IBodyProps, IState> { export default class MPollBody extends React.Component<IBodyProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private seenEventIds: string[] = []; // Events we have already seen private seenEventIds: string[] = []; // Events we have already seen
public constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>) {

View file

@ -42,7 +42,7 @@ interface IState {
export default class MVideoBody extends React.PureComponent<IBodyProps, IState> { export default class MVideoBody extends React.PureComponent<IBodyProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private videoRef = React.createRef<HTMLVideoElement>(); private videoRef = React.createRef<HTMLVideoElement>();
private sizeWatcher?: string; private sizeWatcher?: string;

View file

@ -261,7 +261,7 @@ interface IMessageActionBarProps {
export default class MessageActionBar extends React.PureComponent<IMessageActionBarProps> { export default class MessageActionBar extends React.PureComponent<IMessageActionBarProps> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public componentDidMount(): void { public componentDidMount(): void {
if (this.props.mxEvent.status && this.props.mxEvent.status !== EventStatus.SENT) { if (this.props.mxEvent.status && this.props.mxEvent.status !== EventStatus.SENT) {

View file

@ -90,7 +90,7 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
private evTypes = new Map<string, React.ComponentType<IBodyProps>>(baseEvTypes.entries()); private evTypes = new Map<string, React.ComponentType<IBodyProps>>(baseEvTypes.entries());
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -83,11 +83,10 @@ interface IState {
export default class ReactionsRow extends React.PureComponent<IProps, IState> { export default class ReactionsRow extends React.PureComponent<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public 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.state = { this.state = {
myReactions: this.getMyReactions(), myReactions: this.getMyReactions(),

View file

@ -46,7 +46,7 @@ export interface IProps {
export default class ReactionsRowButton extends React.PureComponent<IProps> { export default class ReactionsRowButton extends React.PureComponent<IProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public onClick = (): void => { public onClick = (): void => {
const { mxEvent, myReactionEvent, content } = this.props; const { mxEvent, myReactionEvent, content } = this.props;

View file

@ -36,7 +36,7 @@ interface IProps {
export default class ReactionsRowButtonTooltip extends React.PureComponent<PropsWithChildren<IProps>> { export default class ReactionsRowButtonTooltip extends React.PureComponent<PropsWithChildren<IProps>> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public render(): React.ReactNode { public render(): React.ReactNode {
const { content, reactionEvents, mxEvent, children } = this.props; const { content, reactionEvents, mxEvent, children } = this.props;

View file

@ -66,7 +66,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
private tooltips: Element[] = []; private tooltips: Element[] = [];
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public state = { public state = {
links: [], links: [],

View file

@ -77,7 +77,7 @@ interface IState {
export default class TimelineCard extends React.Component<IProps, IState> { export default class TimelineCard extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private dispatcherRef?: string; private dispatcherRef?: string;
private layoutWatcherRef?: string; private layoutWatcherRef?: string;

View file

@ -102,7 +102,7 @@ interface IState {
export default class AliasSettings extends React.Component<IProps, IState> { export default class AliasSettings extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: ContextType<typeof MatrixClientContext>; public declare context: ContextType<typeof MatrixClientContext>;
public static defaultProps = { public static defaultProps = {
canSetAliases: false, canSetAliases: false,

View file

@ -56,7 +56,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
private containerRef = createRef<HTMLDivElement>(); private containerRef = createRef<HTMLDivElement>();
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context); super(props, context);

View file

@ -129,7 +129,7 @@ interface IState {
class EditMessageComposer extends React.Component<IEditMessageComposerProps, IState> { class EditMessageComposer extends React.Component<IEditMessageComposerProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private readonly editorRef = createRef<BasicMessageComposer>(); private readonly editorRef = createRef<BasicMessageComposer>();
private readonly dispatcherRef: string; private readonly dispatcherRef: string;
@ -138,7 +138,6 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
public constructor(props: IEditMessageComposerProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: IEditMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
super(props, context); super(props, context);
this.context = context; // otherwise React will only set it prior to render due to type def above
const isRestored = this.createEditorModel(); const isRestored = this.createEditorModel();
const ev = this.props.editState.getEvent(); const ev = this.props.editState.getEvent();

View file

@ -297,7 +297,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
}; };
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private unmounted = false; private unmounted = false;

View file

@ -493,7 +493,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
}; };
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private readonly client = this.props.room.client; private readonly client = this.props.room.client;
private readonly featureAskToJoinWatcher: string; private readonly featureAskToJoinWatcher: string;

View file

@ -82,7 +82,7 @@ export default class MemberList extends React.Component<IProps, IState> {
private mounted = false; private mounted = false;
public static contextType = SDKContext; public static contextType = SDKContext;
public context!: React.ContextType<typeof SDKContext>; public declare context: React.ContextType<typeof SDKContext>;
private tiles: Map<string, MemberTile> = new Map(); private tiles: Map<string, MemberTile> = new Map();
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) { public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {

View file

@ -119,7 +119,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
private _voiceRecording: Optional<VoiceMessageRecording>; private _voiceRecording: Optional<VoiceMessageRecording>;
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public static defaultProps = { public static defaultProps = {
compact: false, compact: false,

View file

@ -298,7 +298,7 @@ interface IPollButtonProps {
class PollButton extends React.PureComponent<IPollButtonProps> { class PollButton extends React.PureComponent<IPollButtonProps> {
public static contextType = OverflowMenuContext; public static contextType = OverflowMenuContext;
public context!: React.ContextType<typeof OverflowMenuContext>; public declare context: React.ContextType<typeof OverflowMenuContext>;
private onCreateClick = (): void => { private onCreateClick = (): void => {
this.context?.(); // close overflow menu this.context?.(); // close overflow menu

View file

@ -40,7 +40,7 @@ const AVATAR_SIZE = "24px";
export default class PinnedEventTile extends React.Component<IProps> { export default class PinnedEventTile extends React.Component<IProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private onTileClicked = (): void => { private onTileClicked = (): void => {
dis.dispatch<ViewRoomPayload>({ dis.dispatch<ViewRoomPayload>({

View file

@ -39,7 +39,7 @@ interface IProps {
export default class ReplyPreview extends React.Component<IProps> { export default class ReplyPreview extends React.Component<IProps> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
public render(): JSX.Element | null { public render(): JSX.Element | null {
if (!this.props.replyToEvent) return null; if (!this.props.replyToEvent) return null;

View file

@ -432,7 +432,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
private treeRef = createRef<HTMLDivElement>(); private treeRef = createRef<HTMLDivElement>();
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -33,7 +33,7 @@ interface IState {
export default class RoomUpgradeWarningBar extends React.PureComponent<IProps, IState> { export default class RoomUpgradeWarningBar extends React.PureComponent<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -44,7 +44,7 @@ interface IProps {
export default class SearchResultTile extends React.Component<IProps> { export default class SearchResultTile extends React.Component<IProps> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
// A map of <callId, LegacyCallEventGrouper> // A map of <callId, LegacyCallEventGrouper>
private callEventGroupers = new Map<string, LegacyCallEventGrouper>(); private callEventGroupers = new Map<string, LegacyCallEventGrouper>();

View file

@ -254,7 +254,7 @@ interface ISendMessageComposerProps extends MatrixClientProps {
export class SendMessageComposer extends React.Component<ISendMessageComposerProps> { export class SendMessageComposer extends React.Component<ISendMessageComposerProps> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private readonly prepareToEncrypt?: DebouncedFunc<() => void>; private readonly prepareToEncrypt?: DebouncedFunc<() => void>;
private readonly editorRef = createRef<BasicMessageComposer>(); private readonly editorRef = createRef<BasicMessageComposer>();
@ -269,7 +269,6 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
public constructor(props: ISendMessageComposerProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: ISendMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
super(props, context); super(props, context);
this.context = context; // otherwise React will only set it prior to render due to type def above
if (this.props.mxClient.isCryptoEnabled() && this.props.mxClient.isRoomEncrypted(this.props.room.roomId)) { if (this.props.mxClient.isCryptoEnabled() && this.props.mxClient.isRoomEncrypted(this.props.room.roomId)) {
this.prepareToEncrypt = throttle( this.prepareToEncrypt = throttle(

View file

@ -63,7 +63,7 @@ interface IState {
*/ */
export default class VoiceRecordComposerTile extends React.PureComponent<IProps, IState> { export default class VoiceRecordComposerTile extends React.PureComponent<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public declare context: React.ContextType<typeof RoomContext>;
private voiceRecordingId: string; private voiceRecordingId: string;
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) { public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {

View file

@ -36,7 +36,7 @@ interface IProps {
export default class BridgeSettingsTab extends React.Component<IProps> { export default class BridgeSettingsTab extends React.Component<IProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private renderBridgeCard(event: MatrixEvent, room: Room | null): ReactNode { private renderBridgeCard(event: MatrixEvent, room: Room | null): ReactNode {
const content = event.getContent(); const content = event.getContent();

View file

@ -42,7 +42,7 @@ interface IState {
export default class GeneralRoomSettingsTab extends React.Component<IProps, IState> { export default class GeneralRoomSettingsTab extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: ContextType<typeof MatrixClientContext>; public declare context: ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -50,7 +50,7 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
private soundUpload = createRef<HTMLInputElement>(); private soundUpload = createRef<HTMLInputElement>();
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -89,7 +89,7 @@ interface IBannedUserProps {
export class BannedUser extends React.Component<IBannedUserProps> { export class BannedUser extends React.Component<IBannedUserProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
private onUnbanClick = (): void => { private onUnbanClick = (): void => {
this.context.unban(this.props.member.roomId, this.props.member.userId).catch((err) => { this.context.unban(this.props.member.roomId, this.props.member.userId).catch((err) => {
@ -137,7 +137,7 @@ interface IProps {
export default class RolesRoomSettingsTab extends React.Component<IProps> { export default class RolesRoomSettingsTab extends React.Component<IProps> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public componentDidMount(): void { public componentDidMount(): void {
this.context.on(RoomStateEvent.Update, this.onRoomStateUpdate); this.context.on(RoomStateEvent.Update, this.onRoomStateUpdate);

View file

@ -67,7 +67,7 @@ interface IState {
export default class SecurityRoomSettingsTab extends React.Component<IProps, IState> { export default class SecurityRoomSettingsTab extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -40,7 +40,7 @@ interface IState {
export default class HelpUserSettingsTab extends React.Component<IProps, IState> { export default class HelpUserSettingsTab extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -59,7 +59,7 @@ const mapDeviceKindToHandlerValue = (deviceKind: MediaDeviceKindEnum): string |
export default class VoiceUserSettingsTab extends React.Component<{}, IState> { export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public constructor(props: {}, context: React.ContextType<typeof MatrixClientContext>) { public constructor(props: {}, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context); super(props, context);

View file

@ -126,8 +126,8 @@ interface CallEventHandlerMap {
* A group call accessed through a widget. * A group call accessed through a widget.
*/ */
export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandlerMap> { export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandlerMap> {
protected readonly widgetUid = WidgetUtils.getWidgetUid(this.widget); protected readonly widgetUid: string;
protected readonly room = this.client.getRoom(this.roomId)!; protected readonly room: Room;
/** /**
* The time after which device member state should be considered expired. * The time after which device member state should be considered expired.
@ -184,6 +184,8 @@ export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandler
protected readonly client: MatrixClient, protected readonly client: MatrixClient,
) { ) {
super(); super();
this.widgetUid = WidgetUtils.getWidgetUid(this.widget);
this.room = this.client.getRoom(this.roomId)!;
} }
/** /**

View file

@ -26,7 +26,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
export class PollStartEventPreview implements IPreview { export class PollStartEventPreview implements IPreview {
public static contextType = MatrixClientContext; public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>; public declare context: React.ContextType<typeof MatrixClientContext>;
public getTextFor(event: MatrixEvent, tagId?: TagID, isThread?: boolean): string | null { public getTextFor(event: MatrixEvent, tagId?: TagID, isThread?: boolean): string | null {
let eventContent = event.getContent(); let eventContent = event.getContent();

View file

@ -20,7 +20,7 @@ import { logger } from "matrix-js-sdk/src/logger";
import { _t } from "../languageHandler"; import { _t } from "../languageHandler";
import SdkConfig from "../SdkConfig"; import SdkConfig from "../SdkConfig";
const subtleCrypto = window.crypto.subtle || window.crypto.webkitSubtle; const subtleCrypto = window.crypto.subtle;
/** /**
* Make an Error object which has a friendlyText property which is already * Make an Error object which has a friendlyText property which is already

View file

@ -35,18 +35,18 @@ import {
* replace individual stores. This is useful for tests which need to mock out stores. * replace individual stores. This is useful for tests which need to mock out stores.
*/ */
export class TestSdkContext extends SdkContextClass { export class TestSdkContext extends SdkContextClass {
public _RightPanelStore?: RightPanelStore; public declare _RightPanelStore?: RightPanelStore;
public _RoomNotificationStateStore?: RoomNotificationStateStore; public declare _RoomNotificationStateStore?: RoomNotificationStateStore;
public _RoomViewStore?: RoomViewStore; public declare _RoomViewStore?: RoomViewStore;
public _WidgetPermissionStore?: WidgetPermissionStore; public declare _WidgetPermissionStore?: WidgetPermissionStore;
public _WidgetLayoutStore?: WidgetLayoutStore; public declare _WidgetLayoutStore?: WidgetLayoutStore;
public _WidgetStore?: WidgetStore; public declare _WidgetStore?: WidgetStore;
public _PosthogAnalytics?: PosthogAnalytics; public declare _PosthogAnalytics?: PosthogAnalytics;
public _SlidingSyncManager?: SlidingSyncManager; public declare _SlidingSyncManager?: SlidingSyncManager;
public _SpaceStore?: SpaceStoreClass; public declare _SpaceStore?: SpaceStoreClass;
public _VoiceBroadcastRecordingsStore?: VoiceBroadcastRecordingsStore; public declare _VoiceBroadcastRecordingsStore?: VoiceBroadcastRecordingsStore;
public _VoiceBroadcastPreRecordingStore?: VoiceBroadcastPreRecordingStore; public declare _VoiceBroadcastPreRecordingStore?: VoiceBroadcastPreRecordingStore;
public _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore; public declare _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore;
constructor() { constructor() {
super(); super();

View file

@ -43,6 +43,7 @@ export class MockedCall extends Call {
}, },
room.client, room.client,
); );
this.groupCall = { creationTs: this.event.getTs() } as unknown as GroupCall;
} }
public static get(room: Room): MockedCall | null { public static get(room: Room): MockedCall | null {
@ -67,7 +68,7 @@ export class MockedCall extends Call {
CallStore.instance.updateRoom(room); CallStore.instance.updateRoom(room);
} }
public readonly groupCall = { creationTs: this.event.getTs() } as unknown as GroupCall; public readonly groupCall: GroupCall;
public get participants(): Map<RoomMember, Set<string>> { public get participants(): Map<RoomMember, Set<string>> {
return super.participants; return super.participants;

View file

@ -4,9 +4,10 @@
"emitDecoratorMetadata": false, "emitDecoratorMetadata": false,
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true, "esModuleInterop": true,
"useDefineForClassFields": true,
"module": "es2022", "module": "es2022",
"moduleResolution": "node", "moduleResolution": "node",
"target": "es2018", "target": "es2022",
"noUnusedLocals": true, "noUnusedLocals": true,
"sourceMap": false, "sourceMap": false,
"outDir": "./lib", "outDir": "./lib",