fix: rely only on RoomMember Role values instead of using the powerLevel.

This commit is contained in:
ganfra
2025-12-01 16:08:11 +01:00
parent 7a1dd24dbd
commit a91c78b56f
10 changed files with 84 additions and 122 deletions

View File

@@ -96,10 +96,7 @@ class LeaveRoomPresenter(
} else {
val hasPrivilegedCreatorRole = roomInfoFlow.value.privilegedCreatorRole
if (!hasPrivilegedCreatorRole) return false
val creators = usersWithRole(RoomMember.Role.Owner(isCreator = true)).first()
val superAdmins = usersWithRole(RoomMember.Role.Owner(isCreator = false)).first()
val owners = creators + superAdmins
val owners = usersWithRole { role -> role is RoomMember.Role.Owner }.first()
return owners.size == 1 && owners.first().userId == sessionId
}
}