Make local echo work for threads (#7157)

This commit is contained in:
Germain 2021-11-24 08:40:15 +00:00 committed by GitHub
parent 7f350ae0f4
commit 392c4ad8d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View file

@ -20,7 +20,7 @@ import React from "react";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { IEncryptedFile, IMediaEventInfo } from "./customisations/models/IMediaEventContent";
import { IUploadOpts } from "matrix-js-sdk/src/@types/requests";
import { MsgType } from "matrix-js-sdk/src/@types/event";
import { MsgType, RelationType } from "matrix-js-sdk/src/@types/event";
import dis from './dispatcher/dispatcher';
import * as sdk from './index';
@ -518,6 +518,7 @@ export default class ContentMessages {
uploadAll = true;
}
}
promBefore = this.sendContentToRoom(file, roomId, relation, matrixClient, promBefore);
}
}
@ -649,7 +650,10 @@ export default class ContentMessages {
return promBefore;
}).then(function() {
if (upload.canceled) throw new UploadCanceledError();
const prom = matrixClient.sendMessage(roomId, content);
const threadId = relation?.rel_type === RelationType.Thread
? relation.event_id
: null;
const prom = matrixClient.sendMessage(roomId, threadId, content);
if (SettingsStore.getValue("Performance.addSendMessageTimingMetadata")) {
prom.then(resp => {
sendRoundTripMetric(matrixClient, roomId, resp.event_id);