diff --git a/.changeset/stupid-pigs-share.md b/.changeset/stupid-pigs-share.md new file mode 100644 index 000000000000..55d68c66d587 --- /dev/null +++ b/.changeset/stupid-pigs-share.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': minor +--- + +Wraps some room settings in an accordion advanced settings section in room edit contextual bar to improve organization diff --git a/apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx b/apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx index ce2a7862bb0b..b49ddb845cdd 100644 --- a/apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx +++ b/apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx @@ -1,3 +1,4 @@ +/* eslint-disable complexity */ import type { IRoomWithRetentionPolicy } from '@rocket.chat/core-typings'; import { isRoomFederated } from '@rocket.chat/core-typings'; import type { SelectOption } from '@rocket.chat/fuselage'; @@ -19,6 +20,7 @@ import { ButtonGroup, Box, TextAreaInput, + AccordionItem, } from '@rocket.chat/fuselage'; import { useEffectEvent, useUniqueId } from '@rocket.chat/fuselage-hooks'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; @@ -223,6 +225,11 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) => const retentionFilesOnlyField = useUniqueId(); const retentionIgnoreThreads = useUniqueId(); + const showAdvancedSettings = canViewEncrypted || canViewReadOnly || readOnly || canViewArchived || canViewJoinCode || canViewHideSysMes; + const showRetentionPolicy = canEditRoomRetentionPolicy && retentionPolicy?.enabled; + + const showAccordion = showAdvancedSettings || showRetentionPolicy; + return ( <> @@ -315,7 +322,6 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) => )} - {canViewType && ( @@ -344,243 +350,258 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) => )} - {canViewEncrypted && ( - - - {t('Encrypted')} - ( - - )} - /> - - - {t('Encrypted_field_hint')} - - - )} - {canViewReadOnly && ( - - - {t('Read_only')} - ( - - )} - /> - - - {readOnly ? t('Read_only_field_hint_enabled', { roomType }) : t('Read_only_field_hint_disabled')} - - - )} - {readOnly && ( - - - {t('React_when_read_only')} - ( - - )} - /> - - - - {reactWhenReadOnly ? t('Anyone_can_react_to_messages') : t('Only_authorized_users_can_react_to_messages')} - - - - )} - {canViewArchived && ( - - - {t('Room_archivation_state_true')} - ( - - )} - /> - - {archived && ( - - {t('New_messages_cannot_be_sent')} - - )} - - )} - {canViewJoinCode && ( - - - {t('Password_to_access')} - ( - - )} - /> - - {joinCodeRequired && ( - - } - /> - - )} - - )} - {canViewHideSysMes && ( - - - {t('Hide_System_Messages')} - ( - - )} - /> - - - ( - - )} - /> - - - )} - {canEditRoomRetentionPolicy && retentionPolicy?.enabled && ( + {showAccordion && ( - - - - - {t('RetentionPolicyRoom_Enabled')} - } - /> - - - - - {t('RetentionPolicyRoom_OverrideGlobal')} - ( - - )} - /> - - - {retentionOverrideGlobal && ( - <> - - {t('RetentionPolicyRoom_ReadTheDocs')} - + {showAdvancedSettings && ( + + + + {t('Security_and_permissions')} + + {canViewEncrypted && ( - - {t('RetentionPolicyRoom_MaxAge', { max: retentionMaxAgeDefault })} - + {t('Encrypted')} ( - ( + ) => onChange(Number(e.currentTarget.value))} + disabled={!canToggleEncryption || isFederated} + checked={value} /> )} /> + + {t('Encrypted_field_hint')} + + )} + {canViewReadOnly && ( - {t('RetentionPolicyRoom_ExcludePinned')} + {t('Read_only')} ( - + )} /> + + {readOnly ? t('Read_only_field_hint_enabled', { roomType }) : t('Read_only_field_hint_disabled')} + + )} + {readOnly && ( - {t('RetentionPolicyRoom_FilesOnly')} + {t('React_when_read_only')} ( - + )} /> + + + {reactWhenReadOnly ? t('Anyone_can_react_to_messages') : t('Only_authorized_users_can_react_to_messages')} + + + )} + {canViewArchived && ( - {t('RetentionPolicy_DoNotPruneThreads')} + {t('Room_archivation_state_true')} ( - + )} /> + {archived && ( + + {t('New_messages_cannot_be_sent')} + + )} - - )} - - + )} + {canViewJoinCode && ( + + + {t('Password_to_access')} + ( + + )} + /> + + {joinCodeRequired && ( + + ( + + )} + /> + + )} + + )} + {canViewHideSysMes && ( + + + {t('Hide_System_Messages')} + ( + + )} + /> + + + ( + + )} + /> + + + )} + + + )} + {showRetentionPolicy && ( + + + + + {t('RetentionPolicyRoom_Enabled')} + ( + + )} + /> + + + + + {t('RetentionPolicyRoom_OverrideGlobal')} + ( + + )} + /> + + + {retentionOverrideGlobal && ( + <> + + {t('RetentionPolicyRoom_ReadTheDocs')} + + + + {t('RetentionPolicyRoom_MaxAge', { max: retentionMaxAgeDefault })} + + + ( + ) => onChange(Number(e.currentTarget.value))} + /> + )} + /> + + + + + {t('RetentionPolicyRoom_ExcludePinned')} + ( + + )} + /> + + + + + {t('RetentionPolicyRoom_FilesOnly')} + ( + + )} + /> + + + + + {t('RetentionPolicy_DoNotPruneThreads')} + ( + + )} + /> + + + + )} + + + )} )} diff --git a/apps/meteor/tests/e2e/e2e-encryption.spec.ts b/apps/meteor/tests/e2e/e2e-encryption.spec.ts index d98acaf847c4..8c6297e9975d 100644 --- a/apps/meteor/tests/e2e/e2e-encryption.spec.ts +++ b/apps/meteor/tests/e2e/e2e-encryption.spec.ts @@ -280,6 +280,7 @@ test.describe.serial('e2e-encryption', () => { await poHomeChannel.tabs.btnRoomInfo.click(); await poHomeChannel.tabs.room.btnEdit.click(); + await poHomeChannel.tabs.room.advancedSettingsAccordion.click(); await expect(poHomeChannel.tabs.room.checkboxEncrypted).toBeVisible(); }); diff --git a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts index a76d89a9d962..78d536448a75 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts @@ -51,6 +51,10 @@ export class HomeFlextabRoom { return this.page.getByRole('dialog').getByRole('alert', { name: 'Retention policy warning callout' }); } + get advancedSettingsAccordion(): Locator { + return this.page.getByRole('dialog').getByRole('button', { name: 'Advanced settings' }); + } + get pruneAccordion(): Locator { return this.page.getByRole('dialog').getByRole('button', { name: 'Prune', exact: true }); } diff --git a/apps/meteor/tests/e2e/retention-policy.spec.ts b/apps/meteor/tests/e2e/retention-policy.spec.ts index 708e5f19b520..4f6b9ce3ff23 100644 --- a/apps/meteor/tests/e2e/retention-policy.spec.ts +++ b/apps/meteor/tests/e2e/retention-policy.spec.ts @@ -115,6 +115,7 @@ test.describe.serial('retention-policy', () => { await auxContext.poHomeChannel.sidenav.openChat(targetChannel); await auxContext.poHomeChannel.tabs.btnRoomInfo.click(); await auxContext.poHomeChannel.tabs.room.btnEdit.click(); + await auxContext.poHomeChannel.tabs.room.advancedSettingsAccordion.click(); await auxContext.poHomeChannel.tabs.room.checkboxReadOnly.check(); await auxContext.poHomeChannel.tabs.room.btnSave.click(); diff --git a/apps/meteor/tests/e2e/team-management.spec.ts b/apps/meteor/tests/e2e/team-management.spec.ts index 55530302ca96..350d55dfaab6 100644 --- a/apps/meteor/tests/e2e/team-management.spec.ts +++ b/apps/meteor/tests/e2e/team-management.spec.ts @@ -77,6 +77,7 @@ test.describe.serial('teams-management', () => { await poHomeTeam.sidenav.openChat(targetTeam); await poHomeTeam.tabs.btnRoomInfo.click(); await poHomeTeam.tabs.room.btnEdit.click(); + await poHomeTeam.tabs.room.advancedSettingsAccordion.click(); await poHomeTeam.tabs.room.checkboxReadOnly.click(); await poHomeTeam.tabs.room.btnSave.click(); });