pr suggestions

This commit is contained in:
Mauro Romito
2025-03-20 19:33:17 +01:00
committed by Mauro
parent 9e0e5bbb13
commit 8e439bc8f5
11 changed files with 31 additions and 25 deletions
@@ -33,10 +33,8 @@ struct RoomInfoProxy: BaseRoomInfoProxyProtocol {
var avatarURL: URL? { roomInfo.avatarUrl.flatMap(URL.init) }
/// The room's avatar info for use in a ``RoomAvatarImage``.
var avatar: RoomAvatar {
if isDirect, avatarURL == nil {
if heroes.count == 1 {
return .heroes(heroes.map(UserProfileProxy.init))
}
if isDirect, avatarURL == nil, heroes.count == 1 {
return .heroes(heroes.map(UserProfileProxy.init))
}
return .room(id: id, name: displayName, avatarURL: avatarURL)
@@ -127,12 +125,9 @@ struct RoomPreviewInfoProxy: BaseRoomInfoProxyProtocol {
/// The room's avatar info for use in a ``RoomAvatarImage``.
var avatar: RoomAvatar {
if isDirect, avatarURL == nil {
if heroes.count == 1 {
return .heroes(heroes.map(UserProfileProxy.init))
}
if isDirect, avatarURL == nil, heroes.count == 1 {
return .heroes(heroes.map(UserProfileProxy.init))
}
return .room(id: id, name: displayName, avatarURL: avatarURL)
}
}