change(roles and permissions): change title for space

This commit is contained in:
ganfra 2025-11-05 21:42:51 +01:00
parent 79cf41d59c
commit 602c32fb9a
6 changed files with 16 additions and 11 deletions

View file

@ -35,6 +35,7 @@ class ChangeRoomPermissionsPresenter(
) : Presenter<ChangeRoomPermissionsState> { ) : Presenter<ChangeRoomPermissionsState> {
companion object { companion object {
private fun itemsForSection(section: RoomPermissionsSection) = when (section) { private fun itemsForSection(section: RoomPermissionsSection) = when (section) {
RoomPermissionsSection.SpaceDetails,
RoomPermissionsSection.RoomDetails -> persistentListOf( RoomPermissionsSection.RoomDetails -> persistentListOf(
RoomPermissionType.ROOM_NAME, RoomPermissionType.ROOM_NAME,
RoomPermissionType.ROOM_AVATAR, RoomPermissionType.ROOM_AVATAR,
@ -53,9 +54,10 @@ class ChangeRoomPermissionsPresenter(
private fun RoomPermissionsSection.shouldShow(isSpace: Boolean): Boolean { private fun RoomPermissionsSection.shouldShow(isSpace: Boolean): Boolean {
return when (this) { return when (this) {
RoomPermissionsSection.RoomDetails -> true RoomPermissionsSection.RoomDetails -> !isSpace
RoomPermissionsSection.MembershipModeration -> true RoomPermissionsSection.MembershipModeration -> true
RoomPermissionsSection.MessagesAndContent -> !isSpace RoomPermissionsSection.MessagesAndContent -> !isSpace
RoomPermissionsSection.SpaceDetails -> isSpace
} }
} }

View file

@ -48,6 +48,7 @@ data class ChangeRoomPermissionsState(
} }
enum class RoomPermissionsSection { enum class RoomPermissionsSection {
SpaceDetails,
RoomDetails, RoomDetails,
MessagesAndContent, MessagesAndContent,
MembershipModeration, MembershipModeration,

View file

@ -74,7 +74,6 @@ fun ChangeRoomPermissionsView(
selectedOption = state.selectedRoleForType(permissionType), selectedOption = state.selectedRoleForType(permissionType),
options = SelectableRole.entries.toImmutableList(), options = SelectableRole.entries.toImmutableList(),
onSelectOption = { role -> onSelectOption = { role ->
println("Selected $role for $permissionType")
state.eventSink( state.eventSink(
ChangeRoomPermissionsEvent.ChangeMinimumRoleForAction( ChangeRoomPermissionsEvent.ChangeMinimumRoleForAction(
action = permissionType, action = permissionType,
@ -114,9 +113,10 @@ fun ChangeRoomPermissionsView(
@Composable @Composable
private fun titleForSection(section: RoomPermissionsSection): String = when (section) { private fun titleForSection(section: RoomPermissionsSection): String = when (section) {
RoomPermissionsSection.RoomDetails -> stringResource(R.string.screen_room_change_permissions_room_details) RoomPermissionsSection.SpaceDetails -> stringResource(R.string.screen_room_roles_and_permissions_space_details)
RoomPermissionsSection.MessagesAndContent -> stringResource(R.string.screen_room_change_permissions_messages_and_content) RoomPermissionsSection.RoomDetails -> stringResource(R.string.screen_room_roles_and_permissions_room_details)
RoomPermissionsSection.MembershipModeration -> stringResource(R.string.screen_room_change_permissions_member_moderation) RoomPermissionsSection.MessagesAndContent -> stringResource(R.string.screen_room_roles_and_permissions_messages_and_content)
RoomPermissionsSection.MembershipModeration -> stringResource(R.string.screen_room_roles_and_permissions_member_moderation)
} }
@Composable @Composable

View file

@ -9,10 +9,10 @@
<string name="screen_room_change_permissions_messages_and_content">"Messages and content"</string> <string name="screen_room_change_permissions_messages_and_content">"Messages and content"</string>
<string name="screen_room_change_permissions_moderators">"Admins and moderators"</string> <string name="screen_room_change_permissions_moderators">"Admins and moderators"</string>
<string name="screen_room_change_permissions_remove_people">"Remove people and decline requests to join"</string> <string name="screen_room_change_permissions_remove_people">"Remove people and decline requests to join"</string>
<string name="screen_room_change_permissions_room_avatar">"Change room avatar"</string> <string name="screen_room_change_permissions_room_avatar">"Change avatar"</string>
<string name="screen_room_change_permissions_room_details">"Room details"</string> <string name="screen_room_change_permissions_room_details">"Room details"</string>
<string name="screen_room_change_permissions_room_name">"Change room name"</string> <string name="screen_room_change_permissions_room_name">"Change name"</string>
<string name="screen_room_change_permissions_room_topic">"Change room topic"</string> <string name="screen_room_change_permissions_room_topic">"Change topic"</string>
<string name="screen_room_change_permissions_send_messages">"Send messages"</string> <string name="screen_room_change_permissions_send_messages">"Send messages"</string>
<string name="screen_room_change_role_administrators_title">"Edit Admins"</string> <string name="screen_room_change_role_administrators_title">"Edit Admins"</string>
<string name="screen_room_change_role_confirm_add_admin_description">"You will not be able to undo this action. You are promoting the user to have the same power level as you."</string> <string name="screen_room_change_role_confirm_add_admin_description">"You will not be able to undo this action. You are promoting the user to have the same power level as you."</string>
@ -66,5 +66,6 @@
<string name="screen_room_roles_and_permissions_reset_confirm_title">"Reset permissions?"</string> <string name="screen_room_roles_and_permissions_reset_confirm_title">"Reset permissions?"</string>
<string name="screen_room_roles_and_permissions_roles_header">"Roles"</string> <string name="screen_room_roles_and_permissions_roles_header">"Roles"</string>
<string name="screen_room_roles_and_permissions_room_details">"Room details"</string> <string name="screen_room_roles_and_permissions_room_details">"Room details"</string>
<string name="screen_room_roles_and_permissions_space_details">"Space details"</string>
<string name="screen_room_roles_and_permissions_title">"Roles and permissions"</string> <string name="screen_room_roles_and_permissions_title">"Roles and permissions"</string>
</resources> </resources>

View file

@ -14,10 +14,10 @@
<string name="screen_room_change_permissions_messages_and_content">"Messages and content"</string> <string name="screen_room_change_permissions_messages_and_content">"Messages and content"</string>
<string name="screen_room_change_permissions_moderators">"Admins and moderators"</string> <string name="screen_room_change_permissions_moderators">"Admins and moderators"</string>
<string name="screen_room_change_permissions_remove_people">"Remove people and decline requests to join"</string> <string name="screen_room_change_permissions_remove_people">"Remove people and decline requests to join"</string>
<string name="screen_room_change_permissions_room_avatar">"Change room avatar"</string> <string name="screen_room_change_permissions_room_avatar">"Change avatar"</string>
<string name="screen_room_change_permissions_room_details">"Room details"</string> <string name="screen_room_change_permissions_room_details">"Room details"</string>
<string name="screen_room_change_permissions_room_name">"Change room name"</string> <string name="screen_room_change_permissions_room_name">"Change name"</string>
<string name="screen_room_change_permissions_room_topic">"Change room topic"</string> <string name="screen_room_change_permissions_room_topic">"Change topic"</string>
<string name="screen_room_change_permissions_send_messages">"Send messages"</string> <string name="screen_room_change_permissions_send_messages">"Send messages"</string>
<string name="screen_room_change_role_administrators_title">"Edit Admins"</string> <string name="screen_room_change_role_administrators_title">"Edit Admins"</string>
<string name="screen_room_change_role_confirm_add_admin_description">"You will not be able to undo this action. You are promoting the user to have the same power level as you."</string> <string name="screen_room_change_role_confirm_add_admin_description">"You will not be able to undo this action. You are promoting the user to have the same power level as you."</string>

View file

@ -371,6 +371,7 @@
"includeRegex" : [ "includeRegex" : [
"screen_room_change_.*", "screen_room_change_.*",
"screen_room_roles_.*", "screen_room_roles_.*",
"screen\\.room_roles_and_permissions\\..*",
"screen_room_member_list.*" "screen_room_member_list.*"
] ]
} }