mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-18 22:58:18 +08:00
Use fallback avatar only for DMs with 2 people
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
abfe6d85a0
commit
c3eb517700
@ -146,15 +146,11 @@ export function avatarUrlForRoom(room: Room, width: number, height: number, resi
|
|||||||
// space rooms cannot be DMs so skip the rest
|
// space rooms cannot be DMs so skip the rest
|
||||||
if (SettingsStore.getValue("feature_spaces") && room.isSpaceRoom()) return null;
|
if (SettingsStore.getValue("feature_spaces") && room.isSpaceRoom()) return null;
|
||||||
|
|
||||||
let otherMember = null;
|
|
||||||
const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
|
const otherUserId = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
|
||||||
if (otherUserId) {
|
if (!otherUserId) return null;
|
||||||
otherMember = room.getMember(otherUserId);
|
|
||||||
} else {
|
// If there are only two members in the DM use the avatar of the other member
|
||||||
// if the room is not marked as a 1:1, but only has max 2 members
|
const otherMember = room.getAvatarFallbackMember(otherUserId);
|
||||||
// then still try to show any avatar (pref. other member)
|
|
||||||
otherMember = room.getAvatarFallbackMember();
|
|
||||||
}
|
|
||||||
if (otherMember?.getMxcAvatarUrl()) {
|
if (otherMember?.getMxcAvatarUrl()) {
|
||||||
return mediaFromMxc(otherMember.getMxcAvatarUrl()).getThumbnailOfSourceHttp(width, height, resizeMethod);
|
return mediaFromMxc(otherMember.getMxcAvatarUrl()).getThumbnailOfSourceHttp(width, height, resizeMethod);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user