Move mxClient to object in sendMessage

t3chguy/dedup-icons-17oct
Florian Duros 2022-10-07 11:02:22 +02:00
parent 21677e67e8
commit c7f912529d
No known key found for this signature in database
GPG Key ID: 9700AA5870258A0B
2 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ export function WysiwygComposer(
} });
const memoizedSendMessage = useCallback(() => {
sendMessage(content, mxClient, { roomContext, ...props });
sendMessage(content, { mxClient, roomContext, ...props });
wysiwyg.clear();
ref.current?.focus();
}, [content, mxClient, roomContext, wysiwyg, props, ref]);

View File

@ -32,6 +32,7 @@ import { IRoomState } from "../../../structures/RoomView";
import dis from '../../../../dispatcher/dispatcher';
interface SendMessageParams {
mxClient: MatrixClient;
relation: IEventRelation;
replyToEvent?: MatrixEvent;
roomContext: IRoomState;
@ -43,7 +44,7 @@ interface SendMessageParams {
export function createMessageContent(
message: string,
{ relation, replyToEvent, permalinkCreator, includeReplyLegacyFallback = true }:
Omit<SendMessageParams, 'roomContext'>,
Omit<SendMessageParams, 'roomContext' | 'mxClient'>,
): IContent {
const isEmote = false;
@ -92,8 +93,7 @@ export function createMessageContent(
export function sendMessage(
message: string,
mxClient: MatrixClient,
{ roomContext, ...params }: SendMessageParams,
{ roomContext, mxClient, ...params }: SendMessageParams,
) {
const { relation, replyToEvent } = params;
const { room } = roomContext;