Render room avatar as fallback for dm group chat (#2398)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Wed, 23 Jul 2025 15:30:02 +0000 (21:00 +0530)
committerGitHub <noreply@github.com>
Wed, 23 Jul 2025 15:30:02 +0000 (21:00 +0530)
* render room avatar for dm group chat

* remove extra conditions

src/app/utils/room.ts

index cae23514651ce86efb4e65275eb74aa6c0182531..a962c45ddc05c78520b6546f0e21b91942629516 100644 (file)
@@ -294,9 +294,14 @@ export const getDirectRoomAvatarUrl = (
   useAuthentication = false
 ): string | undefined => {
   const mxcUrl = room.getAvatarFallbackMember()?.getMxcAvatarUrl();
-  return mxcUrl
-    ? mx.mxcUrlToHttp(mxcUrl, size, size, 'crop', undefined, false, useAuthentication) ?? undefined
-    : undefined;
+
+  if (!mxcUrl) {
+    return getRoomAvatarUrl(mx, room, size, useAuthentication);
+  }
+
+  return (
+    mx.mxcUrlToHttp(mxcUrl, size, size, 'crop', undefined, false, useAuthentication) ?? undefined
+  );
 };
 
 export const trimReplyFromBody = (body: string): string => {