Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(conversation): disable addMember on a one-on-one conversation with deleted account (WPB-10259) #3349

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.wire.android.ui.home.conversations.details

import SwipeableSnackbar
import androidx.annotation.StringRes
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.LocalOverscrollConfiguration
Expand All @@ -34,6 +35,7 @@ import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -111,8 +113,6 @@ import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.UIText
import com.wire.kalium.logic.data.conversation.Conversation
import kotlinx.coroutines.launch
import SwipeableSnackbar
import androidx.compose.material3.SnackbarHost

@RootNavGraph
@WireDestination(
Expand Down Expand Up @@ -394,7 +394,8 @@ private fun GroupConversationDetailsContent(
openFullListPressed = openFullListPressed,
onAddParticipantsPressed = onAddParticipantsPressed,
onProfilePressed = onProfilePressed,
lazyListState = lazyListStates[pageIndex]
lazyListState = lazyListStates[pageIndex],
allowAddMember = conversationSheetState.conversationSheetContent?.title?.isNotEmpty() ?: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to check if the name is not null and there is only one member, since legacy group conversations did allow empty names
this way, legacy groups will still continue to work as before.

)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fun GroupConversationDetailsTopBarCollapsing(
Text(
text = title.ifBlank {
if (isLoading) ""
else UIText.StringResource(R.string.group_unavailable_label).asString()
else UIText.StringResource(R.string.member_name_deleted_label).asString()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is there a reason for the title change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but it was showing different message for the same situation! e.g. when you see a conversation for a deleted user, and open the conversation details, you see the title is not available! so I decided to make it concise.

},
overflow = TextOverflow.Ellipsis,
maxLines = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ fun GroupConversationParticipants(
onProfilePressed: (UIParticipant) -> Unit,
onAddParticipantsPressed: () -> Unit,
groupParticipantsState: GroupConversationParticipantsState,
lazyListState: LazyListState = rememberLazyListState()
lazyListState: LazyListState = rememberLazyListState(),
allowAddMember: Boolean = true
) {
val context = LocalContext.current
Column {
Expand All @@ -86,7 +87,7 @@ fun GroupConversationParticipants(
groupParticipantsState.data.allCount.toString()
)
)
if (groupParticipantsState.data.isSelfAnAdmin) {
if (groupParticipantsState.data.isSelfAnAdmin && allowAddMember) {
WirePrimaryButton(
text = stringResource(R.string.conversation_details_group_participants_add),
fillMaxWidth = true,
Expand Down
Loading