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
|
* or in the main room timeline
|
||||||
*/
|
*/
|
||||||
public get replyInThread(): boolean {
|
public get replyInThread(): boolean {
|
||||||
const replyTo = this.getWireContent()
|
/**
|
||||||
?.["m.relates_to"]
|
* UNSTABLE_ELEMENT_REPLY_IN_THREAD can live either
|
||||||
?.["m.in_reply_to"];
|
* at the m.relates_to and m.in_reply_to level
|
||||||
return (this.replyEventId
|
* This will likely change once we settle on a
|
||||||
&& replyTo[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name])
|
* 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;
|
|| this.thread instanceof Thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1298,13 +1298,6 @@ export class Room extends EventEmitter {
|
|||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
public addThreadedEvent(event: MatrixEvent): void {
|
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();
|
let thread = this.findEventById(event.parentEventId)?.getThread();
|
||||||
if (thread) {
|
if (thread) {
|
||||||
thread.addEvent(event);
|
thread.addEvent(event);
|
||||||
@@ -1332,7 +1325,7 @@ export class Room extends EventEmitter {
|
|||||||
const redactId = event.event.redacts;
|
const redactId = event.event.redacts;
|
||||||
|
|
||||||
// if we know about this event, redact its contents now.
|
// if we know about this event, redact its contents now.
|
||||||
const redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
|
const redactedEvent = this.findEventById(redactId);
|
||||||
if (redactedEvent) {
|
if (redactedEvent) {
|
||||||
redactedEvent.makeRedacted(event);
|
redactedEvent.makeRedacted(event);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user