Fixed #59 : DM room avatar

This commit is contained in:
unknown 2021-08-17 16:37:31 +05:30
parent f49048c6e1
commit 1a3704e700

View file

@ -19,7 +19,9 @@ import AddUserIC from '../../../../public/res/ic/outlined/add-user.svg';
function ChannelViewHeader({ roomId }) { function ChannelViewHeader({ roomId }) {
const mx = initMatrix.matrixClient; 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 roomName = mx.getRoom(roomId).name;
const roomTopic = mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic; const roomTopic = mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic;