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
Delete UnstableValue and use hardcoded value for m.thread
This commit is contained in:
@@ -94,7 +94,9 @@ export enum RelationType {
|
||||
Replace = "m.replace",
|
||||
/**
|
||||
* Note, "io.element.thread" is hardcoded
|
||||
* TypeScript does not allow computed values in enums
|
||||
* Should be replaced with "m.thread" once MSC3440 lands
|
||||
* Can not use `UnstableValue` as TypeScript does not
|
||||
* allow computed values in enums
|
||||
* https://github.com/microsoft/TypeScript/issues/27976
|
||||
*/
|
||||
Thread = "io.element.thread",
|
||||
@@ -174,16 +176,6 @@ export const UNSTABLE_ELEMENT_FUNCTIONAL_USERS = new UnstableValue(
|
||||
"io.element.functional_members",
|
||||
"io.element.functional_members");
|
||||
|
||||
/**
|
||||
* Note, "io.element.thread" is hardcoded in the RelationType enum
|
||||
* TypeScript does not allow computed values in enums
|
||||
* https://github.com/microsoft/TypeScript/issues/27976
|
||||
*/
|
||||
export const UNSTABLE_ELEMENT_THREAD_RELATION = new UnstableValue(
|
||||
"m.thread",
|
||||
"io.element.thread",
|
||||
);
|
||||
|
||||
export interface IEncryptedFile {
|
||||
url: string;
|
||||
mimetype?: string;
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
EventType,
|
||||
MsgType,
|
||||
RelationType,
|
||||
UNSTABLE_ELEMENT_THREAD_RELATION,
|
||||
} from "../@types/event";
|
||||
import { Crypto } from "../crypto";
|
||||
import { deepSortedObjectEntries } from "../utils";
|
||||
@@ -423,7 +422,7 @@ export class MatrixEvent extends EventEmitter {
|
||||
*/
|
||||
public get threadRootId(): string {
|
||||
const relatesTo = this.getWireContent()?.["m.relates_to"];
|
||||
if (relatesTo?.rel_type === UNSTABLE_ELEMENT_THREAD_RELATION.name) {
|
||||
if (relatesTo?.rel_type === RelationType.Thread) {
|
||||
return relatesTo.event_id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user