From f51420ac39dc2d4d52391fc2ba2fb665da3c5da3 Mon Sep 17 00:00:00 2001 From: AndroidBob Date: Fri, 23 Feb 2024 17:35:55 +0100 Subject: [PATCH] fix: show connection request with unavailable name [WPB-6247] (#2718) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Żerko Co-authored-by: Yamil Medina --- .../ConversationListViewModel.kt | 3 ++- .../common/ConversationItemFactory.kt | 19 +++++++++++++++++++ .../model/ConversationItem.kt | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt index 3bc7fd71920..345b2e2a654 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt @@ -591,7 +591,8 @@ private fun ConversationDetails.toConversationItem( ), conversationInfo = ConversationInfo( name = otherUser?.name.orEmpty(), - membership = userTypeMapper.toMembership(userType) + membership = userTypeMapper.toMembership(userType), + isSenderUnavailable = otherUser?.isUnavailableUser ?: true ), lastMessageContent = UILastMessageContent.Connection( connection.status, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt index b7aa6bea877..d4cd700cefe 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt @@ -373,6 +373,25 @@ fun PreviewConnectionConversationItemWithSentConnectRequestBadge() { ) } +@Preview +@Composable +fun PreviewConnectionConversationItemWithSentConnectRequestBadgeWithUnknownSender() { + ConversationItemFactory( + conversation = ConversationItem.ConnectionConversation( + userAvatarData = UserAvatarData(), + conversationId = QualifiedID("value", "domain"), + mutedStatus = MutedConversationStatus.OnlyMentionsAndRepliesAllowed, + lastMessageContent = null, + badgeEventType = BadgeEventType.SentConnectRequest, + conversationInfo = ConversationInfo("", isSenderUnavailable = true) + ), + searchQuery = "", + isSelectableItem = false, + isChecked = false, + {}, {}, {}, {}, {}, {} + ) +} + @Preview @Composable fun PreviewPrivateConversationItemWithBlockedBadge() { diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/model/ConversationItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/model/ConversationItem.kt index dbae33d1b5c..179d6ae12d3 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/model/ConversationItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/model/ConversationItem.kt @@ -126,5 +126,6 @@ fun ConversationItem.ConnectionConversation.toUserInfoLabel() = UserInfoLabel( labelName = conversationInfo.name, isLegalHold = isLegalHold, - membership = conversationInfo.membership + membership = conversationInfo.membership, + unavailable = conversationInfo.isSenderUnavailable )