Refactor out magic string
This commit is contained in:
parent
5c0bbdd4c8
commit
39f68e8c2f
1 changed files with 2 additions and 1 deletions
|
@ -25,6 +25,7 @@ import {getRelation, ANNOTATION_RELATION_TYPE} from "./relations.js";
|
||||||
import {REDACTION_TYPE} from "../common.js";
|
import {REDACTION_TYPE} from "../common.js";
|
||||||
import {NonPersistedEventEntry} from "./entries/NonPersistedEventEntry.js";
|
import {NonPersistedEventEntry} from "./entries/NonPersistedEventEntry.js";
|
||||||
import {DecryptionSource} from "../../e2ee/common.js";
|
import {DecryptionSource} from "../../e2ee/common.js";
|
||||||
|
import {EVENT_TYPE as MEMBER_EVENT_TYPE} from "../members/RoomMember.js";
|
||||||
|
|
||||||
export class Timeline {
|
export class Timeline {
|
||||||
constructor({roomId, storage, closeCallback, fragmentIdComparer, pendingEvents, clock, powerLevelsObservable, hsApi}) {
|
constructor({roomId, storage, closeCallback, fragmentIdComparer, pendingEvents, clock, powerLevelsObservable, hsApi}) {
|
||||||
|
@ -290,7 +291,7 @@ export class Timeline {
|
||||||
async _getEventFromHomeserver(eventId) {
|
async _getEventFromHomeserver(eventId) {
|
||||||
const response = await this._hsApi.context(this._roomId, eventId, 0).response();
|
const response = await this._hsApi.context(this._roomId, eventId, 0).response();
|
||||||
const sender = response.event.sender;
|
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 = {
|
const entry = {
|
||||||
event: response.event,
|
event: response.event,
|
||||||
displayName: member.content.displayname,
|
displayName: member.content.displayname,
|
||||||
|
|
Reference in a new issue