Use doMaybeLocalRoomAction (#9038)

* Use doMaybeLocalRoomAction

* Revert unnecessary changes
This commit is contained in:
Michael Weimann 2022-07-13 07:56:36 +02:00 committed by GitHub
parent 9b8b8763f7
commit 3be20cf434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 333 additions and 22 deletions

View file

@ -58,6 +58,7 @@ import { getSlashCommand, isSlashCommand, runSlashCommand, shouldSendAnyway } fr
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
import { PosthogAnalytics } from "../../../PosthogAnalytics";
import { addReplyToMessageContent } from '../../../utils/Reply';
import { doMaybeLocalRoomAction } from '../../../utils/local-room';
// Merges favouring the given relation
export function attachRelation(content: IContent, relation?: IEventRelation): void {
@ -401,7 +402,11 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
? this.props.relation.event_id
: null;
const prom = this.props.mxClient.sendMessage(roomId, threadId, content);
const prom = doMaybeLocalRoomAction(
roomId,
(actualRoomId: string) => this.props.mxClient.sendMessage(actualRoomId, threadId, content),
this.props.mxClient,
);
if (replyToEvent) {
// Clear reply_to_event as we put the message into the queue
// if the send fails, retry will handle resending.