Merge pull request #5832 from element-hq/feature/fga/fix_owner_admin_displayed_twice

fix: usersWithRole(Owner) returns creators only if privilegedCreatorRole is true
This commit is contained in:
ganfra 2025-12-03 18:19:20 +01:00 committed by GitHub
commit 1234b91a6a
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
}
}