fix room avatar util function

This commit is contained in:
Ajay Bura 2024-03-23 20:54:40 +05:30
parent f96ad8bc48
commit 0846fc80ee

View file

@ -268,12 +268,14 @@ export const getRoomAvatarUrl = (
room: Room, room: Room,
size: 32 | 96 = 32 size: 32 | 96 = 32
): string | undefined => { ): string | undefined => {
const url = const url = room.getAvatarUrl(mx.baseUrl, size, size, 'crop') ?? undefined;
if (url) return url;
return (
room room
.getAvatarFallbackMember() .getAvatarFallbackMember()
?.getAvatarUrl(mx.baseUrl, size, size, 'crop', undefined, false) ?? undefined; ?.getAvatarUrl(mx.baseUrl, size, size, 'crop', undefined, false) ?? undefined
if (url) return url; );
return room.getAvatarUrl(mx.baseUrl, size, size, 'crop') ?? undefined;
}; };
export const trimReplyFromBody = (body: string): string => { export const trimReplyFromBody = (body: string): string => {