You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user