Pass Matrix client around as matrixClient

Signed-off-by: Robin Townsend <robin@robin.town>
pull/21833/head
Robin Townsend 2021-05-24 08:51:04 -04:00
parent 6ced61b709
commit 121ed5eba9
3 changed files with 7 additions and 7 deletions

View File

@ -158,7 +158,7 @@ export default class MessageContextMenu extends React.Component {
onForwardClick = () => { onForwardClick = () => {
Modal.createTrackedDialog('Forward Message', '', ForwardDialog, { Modal.createTrackedDialog('Forward Message', '', ForwardDialog, {
cli: MatrixClientPeg.get(), matrixClient: MatrixClientPeg.get(),
event: this.props.mxEvent, event: this.props.mxEvent,
permalinkCreator: this.props.permalinkCreator, permalinkCreator: this.props.permalinkCreator,
}, 'mx_Dialog_forwardMessage'); }, 'mx_Dialog_forwardMessage');

View File

@ -42,7 +42,7 @@ import {sortRooms} from "../../../stores/room-list/algorithms/tag-sorting/Recent
const AVATAR_SIZE = 30; const AVATAR_SIZE = 30;
interface IProps extends IDialogProps { interface IProps extends IDialogProps {
cli: MatrixClient; matrixClient: MatrixClient;
// The event to forward // The event to forward
event: MatrixEvent; event: MatrixEvent;
// We need a permalink creator for the source room to pass through to EventTile // We need a permalink creator for the source room to pass through to EventTile
@ -53,7 +53,7 @@ interface IProps extends IDialogProps {
interface IEntryProps { interface IEntryProps {
room: Room; room: Room;
event: MatrixEvent; event: MatrixEvent;
cli: MatrixClient; matrixClient: MatrixClient;
onFinished(success: boolean): void; onFinished(success: boolean): void;
} }
@ -64,7 +64,7 @@ enum SendState {
Failed, Failed,
} }
const Entry: React.FC<IEntryProps> = ({ room, event, cli, onFinished }) => { const Entry: React.FC<IEntryProps> = ({ room, event, matrixClient: cli, onFinished }) => {
const [sendState, setSendState] = useState<SendState>(SendState.CanSend); const [sendState, setSendState] = useState<SendState>(SendState.CanSend);
const jumpToRoom = () => { const jumpToRoom = () => {
@ -141,7 +141,7 @@ const Entry: React.FC<IEntryProps> = ({ room, event, cli, onFinished }) => {
</div>; </div>;
}; };
const ForwardDialog: React.FC<IProps> = ({ cli, event, permalinkCreator, onFinished }) => { const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCreator, onFinished }) => {
const userId = cli.getUserId(); const userId = cli.getUserId();
const [profileInfo, setProfileInfo] = useState<any>({}); const [profileInfo, setProfileInfo] = useState<any>({});
useEffect(() => { useEffect(() => {
@ -219,7 +219,7 @@ const ForwardDialog: React.FC<IProps> = ({ cli, event, permalinkCreator, onFinis
key={room.roomId} key={room.roomId}
room={room} room={room}
event={event} event={event}
cli={cli} matrixClient={cli}
onFinished={onFinished} onFinished={onFinished}
/>, />,
) } ) }

View File

@ -47,7 +47,7 @@ describe("ForwardDialog", () => {
await act(async () => { await act(async () => {
wrapper = mount( wrapper = mount(
<ForwardDialog <ForwardDialog
cli={client} matrixClient={client}
event={message} event={message}
permalinkCreator={new RoomPermalinkCreator(undefined, sourceRoom)} permalinkCreator={new RoomPermalinkCreator(undefined, sourceRoom)}
onFinished={jest.fn()} onFinished={jest.fn()}