From 39f68e8c2f4947399ab634b5970d81cad22ca007 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Sun, 12 Dec 2021 21:01:56 +0530 Subject: [PATCH] Refactor out magic string --- src/matrix/room/timeline/Timeline.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 3f48e5a8..e7418d30 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -25,6 +25,7 @@ import {getRelation, ANNOTATION_RELATION_TYPE} from "./relations.js"; import {REDACTION_TYPE} from "../common.js"; import {NonPersistedEventEntry} from "./entries/NonPersistedEventEntry.js"; import {DecryptionSource} from "../../e2ee/common.js"; +import {EVENT_TYPE as MEMBER_EVENT_TYPE} from "../members/RoomMember.js"; export class Timeline { constructor({roomId, storage, closeCallback, fragmentIdComparer, pendingEvents, clock, powerLevelsObservable, hsApi}) { @@ -290,7 +291,7 @@ export class Timeline { async _getEventFromHomeserver(eventId) { const response = await this._hsApi.context(this._roomId, eventId, 0).response(); const sender = response.event.sender; - const member = response.state.find(e => e.type === "m.room.member" && e.user_id === sender); + const member = response.state.find(e => e.type === MEMBER_EVENT_TYPE && e.user_id === sender); const entry = { event: response.event, displayName: member.content.displayname,