1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Prevent redactions to be sent as pending events

Co-authored-by: Dariusz Niemczyk <Palid@users.noreply.github.com>
This commit is contained in:
Germain Souquet
2021-09-30 13:56:52 +01:00
parent 46b3f0babd
commit 1dbd7158ad
2 changed files with 14 additions and 13 deletions

View File

@@ -432,11 +432,19 @@ export class MatrixEvent extends EventEmitter {
* or in the main room timeline
*/
public get replyInThread(): boolean {
const replyTo = this.getWireContent()
?.["m.relates_to"]
?.["m.in_reply_to"];
return (this.replyEventId
&& replyTo[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name])
/**
* UNSTABLE_ELEMENT_REPLY_IN_THREAD can live either
* at the m.relates_to and m.in_reply_to level
* This will likely change once we settle on a
* way to achieve threads
* TODO: Clean this up once we have a clear way forward
*/
const relatesTo = this.getWireContent()?.["m.relates_to"];
const replyTo = relatesTo?.["m.in_reply_to"];
return relatesTo?.[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name]
|| (this.replyEventId && replyTo[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name])
|| this.thread instanceof Thread;
}