diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt index 399ada62f6..313782bf28 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt @@ -73,11 +73,6 @@ class RoomPermissionsController @Inject constructor( stringProvider.getString(R.string.room_permissions_title) ) - settingsInfoItem { - id("notice") - helperText(stringProvider.getString(R.string.room_permissions_notice)) - } - when (val content = data?.currentPowerLevelsContent) { is Success -> buildPermissions(data, content()) else -> { @@ -90,6 +85,12 @@ class RoomPermissionsController @Inject constructor( } private fun buildPermissions(data: RoomPermissionsViewState, content: PowerLevelsContent) { + val editable = data.actionPermissions.canChangePowerLevels + settingsInfoItem { + id("notice") + helperText(stringProvider.getString(if (editable) R.string.room_permissions_notice else R.string.room_permissions_notice_read_only)) + } + allEditablePermissions.forEach { editablePermission -> val currentRole = getCurrentRole(editablePermission, content) buildProfileAction( @@ -99,7 +100,11 @@ class RoomPermissionsController @Inject constructor( dividerColor = dividerColor, divider = true, editable = data.actionPermissions.canChangePowerLevels, - action = { callback?.onEditPermission(editablePermission, currentRole) } + action = { + callback + ?.takeIf { editable } + ?.onEditPermission(editablePermission, currentRole) + } ) } } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 467270b58e..b352d67490 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -615,6 +615,7 @@ "Permissions" "Select the roles required to change various parts of the room" + "You don't have permission to update the roles required to change various parts of the room" Default role Send messages