Comparing mutable state was wrong

This commit is contained in:
Benoit Marty 2025-11-20 16:23:41 +01:00 committed by Benoit Marty
parent 7c6aa0655b
commit c39c4260eb

View file

@ -134,11 +134,10 @@ class ChangeRolesPresenter(
is ChangeRolesEvent.Save -> {
val currentUserIsAdmin = roomInfo.roleOf(room.sessionId) == RoomMember.Role.Admin
val isModifyingAdmins = role == RoomMember.Role.Admin
val hasChanges = selectedUsers != usersWithRole
val isConfirming = saveState.value.isConfirming()
val modifyingOwners = role is RoomMember.Role.Owner
val needsConfirmation = (modifyingOwners || currentUserIsAdmin && isModifyingAdmins) && hasChanges && !isConfirming
val needsConfirmation = (modifyingOwners || currentUserIsAdmin && isModifyingAdmins) && hasPendingChanges && !isConfirming
when {
needsConfirmation -> {