You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Fix typescript types
This commit is contained in:
		@@ -17,8 +17,8 @@ See the License for the specific language governing permissions and
 | 
				
			|||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import * as React from 'react';
 | 
					import * as React from 'react';
 | 
				
			||||||
 | 
					import { User } from "matrix-js-sdk/src/models/user";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import * as ContentHelpers from 'matrix-js-sdk/src/content-helpers';
 | 
					import * as ContentHelpers from 'matrix-js-sdk/src/content-helpers';
 | 
				
			||||||
import {MatrixClientPeg} from './MatrixClientPeg';
 | 
					import {MatrixClientPeg} from './MatrixClientPeg';
 | 
				
			||||||
@@ -1019,9 +1019,8 @@ export const Commands = [
 | 
				
			|||||||
            const member = MatrixClientPeg.get().getRoom(roomId).getMember(userId);
 | 
					            const member = MatrixClientPeg.get().getRoom(roomId).getMember(userId);
 | 
				
			||||||
            dis.dispatch<ViewUserPayload>({
 | 
					            dis.dispatch<ViewUserPayload>({
 | 
				
			||||||
                action: Action.ViewUser,
 | 
					                action: Action.ViewUser,
 | 
				
			||||||
                // XXX: We should be using a real member object and not assuming what the
 | 
					                // XXX: We should be using a real member object and not assuming what the receiver wants.
 | 
				
			||||||
                // receiver wants.
 | 
					                member: member || { userId } as User,
 | 
				
			||||||
                member: member || {userId},
 | 
					 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            return success();
 | 
					            return success();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,10 @@ limitations under the License.
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { useCallback, useEffect, useState } from "react";
 | 
					import React, { useCallback, useEffect, useState } from "react";
 | 
				
			||||||
 | 
					import { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					import { User } from "matrix-js-sdk/src/models/user";
 | 
				
			||||||
 | 
					import { PHASE_REQUESTED, PHASE_UNSENT } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import EncryptionInfo from "./EncryptionInfo";
 | 
					import EncryptionInfo from "./EncryptionInfo";
 | 
				
			||||||
import VerificationPanel from "./VerificationPanel";
 | 
					import VerificationPanel from "./VerificationPanel";
 | 
				
			||||||
@@ -22,11 +26,8 @@ import {MatrixClientPeg} from "../../../MatrixClientPeg";
 | 
				
			|||||||
import { ensureDMExists } from "../../../createRoom";
 | 
					import { ensureDMExists } from "../../../createRoom";
 | 
				
			||||||
import { useEventEmitter } from "../../../hooks/useEventEmitter";
 | 
					import { useEventEmitter } from "../../../hooks/useEventEmitter";
 | 
				
			||||||
import Modal from "../../../Modal";
 | 
					import Modal from "../../../Modal";
 | 
				
			||||||
import {PHASE_REQUESTED, PHASE_UNSENT} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
 | 
					 | 
				
			||||||
import * as sdk from "../../../index";
 | 
					import * as sdk from "../../../index";
 | 
				
			||||||
import { _t } from "../../../languageHandler";
 | 
					import { _t } from "../../../languageHandler";
 | 
				
			||||||
import {VerificationRequest} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
 | 
					 | 
				
			||||||
import {RoomMember} from "matrix-js-sdk/src/models/room-member";
 | 
					 | 
				
			||||||
import dis from "../../../dispatcher/dispatcher";
 | 
					import dis from "../../../dispatcher/dispatcher";
 | 
				
			||||||
import { Action } from "../../../dispatcher/actions";
 | 
					import { Action } from "../../../dispatcher/actions";
 | 
				
			||||||
import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
 | 
					import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
 | 
				
			||||||
@@ -35,7 +36,7 @@ import {RightPanelPhases} from "../../../stores/RightPanelStorePhases";
 | 
				
			|||||||
const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
 | 
					const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IProps {
 | 
					interface IProps {
 | 
				
			||||||
    member: RoomMember;
 | 
					    member: RoomMember | User;
 | 
				
			||||||
    onClose: () => void;
 | 
					    onClose: () => void;
 | 
				
			||||||
    verificationRequest: VerificationRequest;
 | 
					    verificationRequest: VerificationRequest;
 | 
				
			||||||
    verificationRequestPromise: Promise<VerificationRequest>;
 | 
					    verificationRequestPromise: Promise<VerificationRequest>;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1594,7 +1594,7 @@ const UserInfo: React.FC<IProps> = ({
 | 
				
			|||||||
            content = (
 | 
					            content = (
 | 
				
			||||||
                <BasicUserInfo
 | 
					                <BasicUserInfo
 | 
				
			||||||
                    room={room}
 | 
					                    room={room}
 | 
				
			||||||
                    member={member}
 | 
					                    member={member as User}
 | 
				
			||||||
                    groupId={groupId as string}
 | 
					                    groupId={groupId as string}
 | 
				
			||||||
                    devices={devices}
 | 
					                    devices={devices}
 | 
				
			||||||
                    isRoomEncrypted={isRoomEncrypted} />
 | 
					                    isRoomEncrypted={isRoomEncrypted} />
 | 
				
			||||||
@@ -1605,7 +1605,7 @@ const UserInfo: React.FC<IProps> = ({
 | 
				
			|||||||
            content = (
 | 
					            content = (
 | 
				
			||||||
                <EncryptionPanel
 | 
					                <EncryptionPanel
 | 
				
			||||||
                    {...props as React.ComponentProps<typeof EncryptionPanel>}
 | 
					                    {...props as React.ComponentProps<typeof EncryptionPanel>}
 | 
				
			||||||
                    member={member}
 | 
					                    member={member as User | RoomMember}
 | 
				
			||||||
                    onClose={onEncryptionPanelClose}
 | 
					                    onClose={onEncryptionPanelClose}
 | 
				
			||||||
                    isRoomEncrypted={isRoomEncrypted}
 | 
					                    isRoomEncrypted={isRoomEncrypted}
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,9 @@ limitations under the License.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import React, { useContext } from "react";
 | 
					import React, { useContext } from "react";
 | 
				
			||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
 | 
					import { EventType } from "matrix-js-sdk/src/@types/event";
 | 
				
			||||||
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
 | 
					import { User } from "matrix-js-sdk/src/models/user";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
 | 
					import MatrixClientContext from "../../../contexts/MatrixClientContext";
 | 
				
			||||||
import RoomContext from "../../../contexts/RoomContext";
 | 
					import RoomContext from "../../../contexts/RoomContext";
 | 
				
			||||||
@@ -30,9 +33,7 @@ import {Action} from "../../../dispatcher/actions";
 | 
				
			|||||||
import dis from "../../../dispatcher/dispatcher";
 | 
					import dis from "../../../dispatcher/dispatcher";
 | 
				
			||||||
import SpaceStore from "../../../stores/SpaceStore";
 | 
					import SpaceStore from "../../../stores/SpaceStore";
 | 
				
			||||||
import { showSpaceInvite } from "../../../utils/space";
 | 
					import { showSpaceInvite } from "../../../utils/space";
 | 
				
			||||||
 | 
					 | 
				
			||||||
import { privateShouldBeEncrypted } from "../../../createRoom";
 | 
					import { privateShouldBeEncrypted } from "../../../createRoom";
 | 
				
			||||||
 | 
					 | 
				
			||||||
import EventTileBubble from "../messages/EventTileBubble";
 | 
					import EventTileBubble from "../messages/EventTileBubble";
 | 
				
			||||||
import { ROOM_SECURITY_TAB } from "../dialogs/RoomSettingsDialog";
 | 
					import { ROOM_SECURITY_TAB } from "../dialogs/RoomSettingsDialog";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -61,7 +62,7 @@ const NewRoomIntro = () => {
 | 
				
			|||||||
                defaultDispatcher.dispatch<ViewUserPayload>({
 | 
					                defaultDispatcher.dispatch<ViewUserPayload>({
 | 
				
			||||||
                    action: Action.ViewUser,
 | 
					                    action: Action.ViewUser,
 | 
				
			||||||
                    // XXX: We should be using a real member object and not assuming what the receiver wants.
 | 
					                    // XXX: We should be using a real member object and not assuming what the receiver wants.
 | 
				
			||||||
                    member: member || {userId: dmPartner},
 | 
					                    member: member || { userId: dmPartner } as User,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }} />
 | 
					            }} />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ limitations under the License.
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					import { User } from "matrix-js-sdk/src/models/user";
 | 
				
			||||||
import { ActionPayload } from "../payloads";
 | 
					import { ActionPayload } from "../payloads";
 | 
				
			||||||
import { Action } from "../actions";
 | 
					import { Action } from "../actions";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,5 +26,5 @@ export interface ViewUserPayload extends ActionPayload {
 | 
				
			|||||||
     * The member to view. May be null or falsy to indicate that no member
 | 
					     * The member to view. May be null or falsy to indicate that no member
 | 
				
			||||||
     * should be shown (hide whichever relevant components).
 | 
					     * should be shown (hide whichever relevant components).
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    member?: RoomMember;
 | 
					    member?: RoomMember | User;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -276,7 +276,7 @@ class RoomViewStore extends Store<ActionPayload> {
 | 
				
			|||||||
        const address = this.state.roomAlias || this.state.roomId;
 | 
					        const address = this.state.roomAlias || this.state.roomId;
 | 
				
			||||||
        const viaServers = this.state.viaServers || [];
 | 
					        const viaServers = this.state.viaServers || [];
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            await retry<void, MatrixError>(() => cli.joinRoom(address, {
 | 
					            await retry<any, MatrixError>(() => cli.joinRoom(address, {
 | 
				
			||||||
                viaServers,
 | 
					                viaServers,
 | 
				
			||||||
                ...payload.opts,
 | 
					                ...payload.opts,
 | 
				
			||||||
            }), NUM_JOIN_RETRY, (err) => {
 | 
					            }), NUM_JOIN_RETRY, (err) => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ import { setHasDiff } from "../../../utils/sets";
 | 
				
			|||||||
 *  + All DMs
 | 
					 *  + All DMs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export class SpaceFilterCondition extends EventEmitter implements IFilterCondition, IDestroyable {
 | 
					export class SpaceFilterCondition extends EventEmitter implements IFilterCondition, IDestroyable {
 | 
				
			||||||
    private roomIds = new Set<Room>();
 | 
					    private roomIds = new Set<string>();
 | 
				
			||||||
    private space: Room = null;
 | 
					    private space: Room = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public get kind(): FilterKind {
 | 
					    public get kind(): FilterKind {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,9 @@ limitations under the License.
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import * as url from "url";
 | 
					import * as url from "url";
 | 
				
			||||||
 | 
					import { Capability, IWidget, IWidgetData, MatrixCapabilities } from "matrix-widget-api";
 | 
				
			||||||
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
 | 
					import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { MatrixClientPeg } from '../MatrixClientPeg';
 | 
					import { MatrixClientPeg } from '../MatrixClientPeg';
 | 
				
			||||||
import SdkConfig from "../SdkConfig";
 | 
					import SdkConfig from "../SdkConfig";
 | 
				
			||||||
@@ -23,11 +26,9 @@ import dis from '../dispatcher/dispatcher';
 | 
				
			|||||||
import WidgetEchoStore from '../stores/WidgetEchoStore';
 | 
					import WidgetEchoStore from '../stores/WidgetEchoStore';
 | 
				
			||||||
import SettingsStore from "../settings/SettingsStore";
 | 
					import SettingsStore from "../settings/SettingsStore";
 | 
				
			||||||
import { IntegrationManagers } from "../integrations/IntegrationManagers";
 | 
					import { IntegrationManagers } from "../integrations/IntegrationManagers";
 | 
				
			||||||
import {Room} from "matrix-js-sdk/src/models/room";
 | 
					 | 
				
			||||||
import { WidgetType } from "../widgets/WidgetType";
 | 
					import { WidgetType } from "../widgets/WidgetType";
 | 
				
			||||||
import { objectClone } from "./objects";
 | 
					import { objectClone } from "./objects";
 | 
				
			||||||
import { _t } from "../languageHandler";
 | 
					import { _t } from "../languageHandler";
 | 
				
			||||||
import {Capability, IWidget, IWidgetData, MatrixCapabilities} from "matrix-widget-api";
 | 
					 | 
				
			||||||
import { IApp } from "../stores/WidgetStore";
 | 
					import { IApp } from "../stores/WidgetStore";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// How long we wait for the state event echo to come back from the server
 | 
					// How long we wait for the state event echo to come back from the server
 | 
				
			||||||
@@ -377,9 +378,9 @@ export default class WidgetUtils {
 | 
				
			|||||||
        return widgets.filter(w => w.content && w.content.type === "m.integration_manager");
 | 
					        return widgets.filter(w => w.content && w.content.type === "m.integration_manager");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static getRoomWidgetsOfType(room: Room, type: WidgetType): IWidgetEvent[] {
 | 
					    static getRoomWidgetsOfType(room: Room, type: WidgetType): MatrixEvent[] {
 | 
				
			||||||
        const widgets = WidgetUtils.getRoomWidgets(room);
 | 
					        const widgets = WidgetUtils.getRoomWidgets(room) || [];
 | 
				
			||||||
        return (widgets || []).filter(w => {
 | 
					        return widgets.filter(w => {
 | 
				
			||||||
            const content = w.getContent();
 | 
					            const content = w.getContent();
 | 
				
			||||||
            return content.url && type.matches(content.type);
 | 
					            return content.url && type.matches(content.type);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user