Fix crash on invite from dendrite hs (#453)

This commit is contained in:
Ajay Bura 2022-04-24 17:10:18 +05:30
parent 87f3afd8fd
commit 44c3dec9dc

View file

@ -54,17 +54,19 @@ function InviteList({ isOpen, onRequestClose }) {
}, [procInvite]); }, [procInvite]);
function renderRoomTile(roomId) { function renderRoomTile(roomId) {
const myRoom = initMatrix.matrixClient.getRoom(roomId); const mx = initMatrix.matrixClient;
const myRoom = mx.getRoom(roomId);
const roomName = myRoom.name; const roomName = myRoom.name;
let roomAlias = myRoom.getCanonicalAlias(); let roomAlias = myRoom.getCanonicalAlias();
if (roomAlias === null) roomAlias = myRoom.roomId; if (roomAlias === null) roomAlias = myRoom.roomId;
const inviterName = myRoom.getMember(mx.getUserId())?.events?.member?.getSender?.() ?? '';
return ( return (
<RoomTile <RoomTile
key={myRoom.roomId} key={myRoom.roomId}
name={roomName} name={roomName}
avatarSrc={initMatrix.matrixClient.getRoom(roomId).getAvatarUrl(initMatrix.matrixClient.baseUrl, 42, 42, 'crop')} avatarSrc={initMatrix.matrixClient.getRoom(roomId).getAvatarUrl(initMatrix.matrixClient.baseUrl, 42, 42, 'crop')}
id={roomAlias} id={roomAlias}
inviterName={myRoom.getJoinedMembers()[0].userId} inviterName={inviterName}
options={ options={
procInvite.has(myRoom.roomId) procInvite.has(myRoom.roomId)
? (<Spinner size="small" />) ? (<Spinner size="small" />)