From 1a3704e700605b31bc6bce578b1ae276236d058b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Aug 2021 16:37:31 +0530 Subject: [PATCH] Fixed #59 : DM room avatar --- src/app/organisms/channel/ChannelViewHeader.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/organisms/channel/ChannelViewHeader.jsx b/src/app/organisms/channel/ChannelViewHeader.jsx index b9f56d8..9e9a40d 100644 --- a/src/app/organisms/channel/ChannelViewHeader.jsx +++ b/src/app/organisms/channel/ChannelViewHeader.jsx @@ -19,7 +19,9 @@ import AddUserIC from '../../../../public/res/ic/outlined/add-user.svg'; function ChannelViewHeader({ roomId }) { const mx = initMatrix.matrixClient; - const avatarSrc = mx.getRoom(roomId).getAvatarUrl(mx.baseUrl, 36, 36, 'crop'); + const isDM = initMatrix.roomList.directs.has(roomId); + let avatarSrc = mx.getRoom(roomId).getAvatarUrl(mx.baseUrl, 36, 36, 'crop'); + avatarSrc = isDM ? mx.getRoom(roomId).getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 24, 24, 'crop') : avatarSrc; const roomName = mx.getRoom(roomId).name; const roomTopic = mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;