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
Switch to using stable values for Threads (#2228)
This commit is contained in:
@@ -28,7 +28,7 @@ import { EVENT_VISIBILITY_CHANGE_TYPE, EventType, MsgType, RelationType } from "
|
||||
import { Crypto, IEventDecryptionResult } from "../crypto";
|
||||
import { deepSortedObjectEntries } from "../utils";
|
||||
import { RoomMember } from "./room-member";
|
||||
import { Thread, ThreadEvent, EventHandlerMap as ThreadEventHandlerMap } from "./thread";
|
||||
import { Thread, ThreadEvent, EventHandlerMap as ThreadEventHandlerMap, THREAD_RELATION_TYPE } from "./thread";
|
||||
import { IActionsObject } from '../pushprocessor';
|
||||
import { TypedReEmitter } from '../ReEmitter';
|
||||
import { MatrixError } from "../http-api";
|
||||
@@ -505,7 +505,7 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
|
||||
*/
|
||||
public get threadRootId(): string | undefined {
|
||||
const relatesTo = this.getWireContent()?.["m.relates_to"];
|
||||
if (relatesTo?.rel_type === RelationType.Thread) {
|
||||
if (relatesTo?.rel_type === THREAD_RELATION_TYPE.name) {
|
||||
return relatesTo.event_id;
|
||||
} else {
|
||||
return this.getThread()?.id || this.threadId;
|
||||
@@ -524,7 +524,7 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
|
||||
*/
|
||||
public get isThreadRoot(): boolean {
|
||||
const threadDetails = this
|
||||
.getServerAggregatedRelation<IThreadBundledRelationship>(RelationType.Thread);
|
||||
.getServerAggregatedRelation<IThreadBundledRelationship>(THREAD_RELATION_TYPE.name);
|
||||
|
||||
// Bundled relationships only returned when the sync response is limited
|
||||
// hence us having to check both bundled relation and inspect the thread
|
||||
@@ -1357,7 +1357,7 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public getServerAggregatedRelation<T>(relType: RelationType): T | undefined {
|
||||
public getServerAggregatedRelation<T>(relType: RelationType | string): T | undefined {
|
||||
return this.getUnsigned()["m.relations"]?.[relType];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user