The name ConfirmingBanUser was wrong since it was used to confirm a unban action. Better to keep a generic name, in case this class is used for any other action.

This commit is contained in:
Benoit Marty 2024-10-16 11:58:54 +02:00
parent 0baa0dbfc3
commit 9aafcc7564
6 changed files with 12 additions and 10 deletions

View file

@ -10,6 +10,6 @@ package io.element.android.features.roomdetails.impl.members.moderation
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.matrix.api.room.RoomMember
data class ConfirmingBanUser(
data class ConfirmingRoomMemberAction(
val roomMember: RoomMember,
) : AsyncAction.Confirming

View file

@ -88,8 +88,10 @@ class RoomMembersModerationPresenter @Inject constructor(
when (event) {
is RoomMembersModerationEvents.SelectRoomMember -> {
if (event.roomMember.membership == RoomMembershipState.BAN && canBan) {
unbanUserAsyncAction.value = ConfirmingBanUser(event.roomMember)
// In this case the view will render a dialog to confirm the unbanning of the user
unbanUserAsyncAction.value = ConfirmingRoomMemberAction(event.roomMember)
} else {
// In this case the view will render a bottom sheet.
selectedMember = event.roomMember
}
}

View file

@ -60,7 +60,7 @@ class RoomMembersModerationStateProvider : PreviewParameterProvider<RoomMembersM
),
aRoomMembersModerationState(
selectedRoomMember = anAlice(),
unbanUserAsyncAction = ConfirmingBanUser(anAlice()),
unbanUserAsyncAction = ConfirmingRoomMemberAction(anAlice()),
),
aRoomMembersModerationState(
kickUserAsyncAction = AsyncAction.Success(Unit),

View file

@ -147,7 +147,7 @@ fun RoomMembersModerationView(
when (val action = state.unbanUserAsyncAction) {
is AsyncAction.Confirming -> {
if (action is ConfirmingBanUser) {
if (action is ConfirmingRoomMemberAction) {
ConfirmationDialog(
title = stringResource(R.string.screen_room_member_list_manage_member_unban_title),
content = stringResource(R.string.screen_room_member_list_manage_member_unban_message),