Merge pull request #1962 from matrix-org/gsouquet/fix-19229

This commit is contained in:
Germain
2021-10-01 15:46:30 +01:00
committed by GitHub
2 changed files with 14 additions and 13 deletions
+13 -5
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;
}
+1 -8
View File
@@ -1298,13 +1298,6 @@ export class Room extends EventEmitter {
* @experimental
*/
public addThreadedEvent(event: MatrixEvent): void {
if (event.getUnsigned().transaction_id) {
const existingEvent = this.txnToEvent[event.getUnsigned().transaction_id];
if (existingEvent) {
// remote echo of an event we sent earlier
this.handleRemoteEcho(event, existingEvent);
}
}
let thread = this.findEventById(event.parentEventId)?.getThread();
if (thread) {
thread.addEvent(event);
@@ -1332,7 +1325,7 @@ export class Room extends EventEmitter {
const redactId = event.event.redacts;
// if we know about this event, redact its contents now.
const redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
const redactedEvent = this.findEventById(redactId);
if (redactedEvent) {
redactedEvent.makeRedacted(event);