From 696980aca479428ed674b89cf1bfae28eeae4758 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 7 Dec 2021 12:19:11 +0530 Subject: [PATCH] Parse display name and avatar of event --- src/matrix/room/BaseRoom.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index b483d65b..1c1e3720 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -562,9 +562,15 @@ export class BaseRoom extends EventEmitter { } async _getEventFromHomeserver(eventId) { - const response = await this._hsApi.event(this._roomId, eventId).response(); - const entry = new EventEntry({ event: response }, this._fragmentIdComparer); - return entry; + 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 entry = { + event: response.event, + displayName: member.content.displayname, + avatarUrl: member.content.avatar_url + }; + return new EventEntry(entry, this._fragmentIdComparer); }