mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Refactor out magic string
This commit is contained in:
parent
5c0bbdd4c8
commit
39f68e8c2f
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user