From f44fa775dec66e73201b8240b2726e9d122941f5 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 22 Dec 2021 12:37:36 +0530 Subject: [PATCH] Move threading relation type const to relations.js --- src/matrix/room/timeline/entries/BaseEventEntry.js | 6 +++--- src/matrix/room/timeline/entries/reply.js | 8 +++----- src/matrix/room/timeline/relations.js | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index 884bffa9..dca486f6 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -16,9 +16,9 @@ limitations under the License. import {BaseEntry} from "./BaseEntry"; import {REDACTION_TYPE} from "../../common.js"; -import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js"; +import {createAnnotation, ANNOTATION_RELATION_TYPE, THREADING_RELATION_TYPE, getRelationFromContent} from "../relations.js"; import {PendingAnnotation} from "../PendingAnnotation.js"; -import {createReplyContent, THREADING_REL_TYPE} from "./reply.js" +import {createReplyContent} from "./reply.js"; /** Deals mainly with local echo for relations and redactions, * so it is shared between PendingEventEntry and EventEntry */ @@ -36,7 +36,7 @@ export class BaseEventEntry extends BaseEntry { } get isThread() { - return this.relation?.["rel_type"] === THREADING_REL_TYPE; + return this.relation?.["rel_type"] === THREADING_RELATION_TYPE; } get isRedacting() { diff --git a/src/matrix/room/timeline/entries/reply.js b/src/matrix/room/timeline/entries/reply.js index 8b503118..7b05b272 100644 --- a/src/matrix/room/timeline/entries/reply.js +++ b/src/matrix/room/timeline/entries/reply.js @@ -14,9 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {getRelatedEventId} from "../relations.js"; - -export const THREADING_REL_TYPE = "io.element.thread"; +import {getRelatedEventId, THREADING_RELATION_TYPE} from "../relations.js"; function htmlEscape(string) { return string.replace(/&/g, "&").replace(//g, ">"); @@ -54,7 +52,7 @@ function _createReplyContent(targetId, msgtype, body, formattedBody, threadId) { }; if (threadId) { Object.assign(reply["m.relates_to"], { - rel_type: THREADING_REL_TYPE, + rel_type: THREADING_RELATION_TYPE, event_id: threadId, }); } @@ -93,7 +91,7 @@ function createThreadContent(entry, msgtype, body) { msgtype, body, "m.relates_to": { - "rel_type": THREADING_REL_TYPE, + "rel_type": THREADING_RELATION_TYPE, "event_id": getRelatedEventId(entry) } }; diff --git a/src/matrix/room/timeline/relations.js b/src/matrix/room/timeline/relations.js index 2d9217ad..d92847ec 100644 --- a/src/matrix/room/timeline/relations.js +++ b/src/matrix/room/timeline/relations.js @@ -18,6 +18,7 @@ import {REDACTION_TYPE} from "../common.js"; export const REACTION_TYPE = "m.reaction"; export const ANNOTATION_RELATION_TYPE = "m.annotation"; +export const THREADING_RELATION_TYPE = "io.element.thread"; export function createAnnotation(targetId, key) { return {