mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
the sec and privacy screen is only displayed if at least one available action can be displayed.
This commit is contained in:
@@ -292,7 +292,8 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
|||||||
state.canBanUsers = powerLevels.canOwnUserBan()
|
state.canBanUsers = powerLevels.canOwnUserBan()
|
||||||
state.canJoinCall = powerLevels.canOwnUserJoinCall()
|
state.canJoinCall = powerLevels.canOwnUserJoinCall()
|
||||||
state.canEditRolesOrPermissions = powerLevels.canOwnUserEditRolesAndPermissions()
|
state.canEditRolesOrPermissions = powerLevels.canOwnUserEditRolesAndPermissions()
|
||||||
state.canEditSecurityAndPrivacy = powerLevels.canOwnUserEditSecurityAndPrivacy()
|
state.canEditSecurityAndPrivacy = powerLevels.canOwnUserEditSecurityAndPrivacy(isSpace: roomInfo.isSpace,
|
||||||
|
joinRule: roomInfo.joinRule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,18 @@ extension RoomPowerLevelsProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Can own user edit any of the security and privacy settings.
|
/// Can own user edit any of the security and privacy settings.
|
||||||
func canOwnUserEditSecurityAndPrivacy() -> Bool {
|
func canOwnUserEditSecurityAndPrivacy(isSpace: Bool, joinRule: JoinRule?) -> Bool {
|
||||||
canOwnUser(sendStateEvent: .roomEncryption) || canOwnUser(sendStateEvent: .roomAliases) || canOwnUser(sendStateEvent: .roomJoinRules) || canOwnUser(sendStateEvent: .roomHistoryVisibility)
|
let canOwnUserChangeAddress = switch joinRule {
|
||||||
|
case .knockRestricted, .knock, .public:
|
||||||
|
canOwnUser(sendStateEvent: .roomAliases)
|
||||||
|
default:
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
return if isSpace {
|
||||||
|
canOwnUser(sendStateEvent: .roomJoinRules) || canOwnUserChangeAddress
|
||||||
|
} else {
|
||||||
|
canOwnUser(sendStateEvent: .roomEncryption) || canOwnUser(sendStateEvent: .roomJoinRules) || canOwnUser(sendStateEvent: .roomHistoryVisibility) || canOwnUserChangeAddress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user