Skip to content

Commit 27cc5b7

Browse files
authored
feat: Remove e2ee config from edit room panel (RocketChat#36945)
1 parent b0a4602 commit 27cc5b7

5 files changed

Lines changed: 6 additions & 60 deletions

File tree

.changeset/polite-garlics-wash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/meteor': minor
3+
---
4+
5+
It removes the encrypted input from the edit room panel in order to avoid duplicated configurations with the same purpose

apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) =>
131131
canSetReactWhenReadOnly,
132132
canEditRoomRetentionPolicy,
133133
canArchiveOrUnarchive,
134-
canToggleEncryption,
135134
canViewName,
136135
canViewTopic,
137136
canViewAnnouncement,
@@ -141,7 +140,6 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) =>
141140
canViewReadOnly,
142141
canViewHideSysMes,
143142
canViewJoinCode,
144-
canViewEncrypted,
145143
} = useEditRoomPermissions(room);
146144

147145
const changeArchiving = archived !== !!room.archived;
@@ -223,15 +221,14 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) =>
223221
const archivedField = useId();
224222
const joinCodeRequiredField = useId();
225223
const hideSysMesField = useId();
226-
const encryptedField = useId();
227224
const retentionEnabledField = useId();
228225
const retentionOverrideGlobalField = useId();
229226
const retentionMaxAgeField = useId();
230227
const retentionExcludePinnedField = useId();
231228
const retentionFilesOnlyField = useId();
232229
const retentionIgnoreThreads = useId();
233230

234-
const showAdvancedSettings = canViewEncrypted || canViewReadOnly || readOnly || canViewArchived || canViewJoinCode || canViewHideSysMes;
231+
const showAdvancedSettings = canViewReadOnly || readOnly || canViewArchived || canViewJoinCode || canViewHideSysMes;
235232
const showRetentionPolicy = canEditRoomRetentionPolicy && retentionPolicy?.enabled;
236233

237234
const showAccordion = showAdvancedSettings || showRetentionPolicy;
@@ -365,29 +362,6 @@ const EditRoomInfo = ({ room, onClickClose, onClickBack }: EditRoomInfoProps) =>
365362
<Box is='h5' fontScale='h5' color='titles-labels'>
366363
{t('Security_and_permissions')}
367364
</Box>
368-
{canViewEncrypted && (
369-
<Field>
370-
<FieldRow>
371-
<FieldLabel htmlFor={encryptedField}>{t('Encrypted')}</FieldLabel>
372-
<Controller
373-
control={control}
374-
name='encrypted'
375-
render={({ field: { value, ...field } }) => (
376-
<ToggleSwitch
377-
id={encryptedField}
378-
aria-describedby={`${encryptedField}-hint`}
379-
{...field}
380-
disabled={!canToggleEncryption || isFederated}
381-
checked={value}
382-
/>
383-
)}
384-
/>
385-
</FieldRow>
386-
<FieldRow>
387-
<FieldHint id={`${encryptedField}-hint`}>{t('Encrypted_field_hint')}</FieldHint>
388-
</FieldRow>
389-
</Field>
390-
)}
391365
{canViewReadOnly && (
392366
<Field>
393367
<FieldRow>

apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/useEditRoomPermissions.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ import { useMemo } from 'react';
44

55
import { RoomSettingsEnum } from '../../../../../../definition/IRoomTypeConfig';
66
import { useTeamInfoQuery } from '../../../../../hooks/useTeamInfoQuery';
7-
import { E2EEState } from '../../../../../lib/e2ee/E2EEState';
87
import { roomCoordinator } from '../../../../../lib/rooms/roomCoordinator';
9-
import { useE2EEState } from '../../../hooks/useE2EEState';
108

119
const getCanChangeType = (room: IRoom | IRoomWithRetentionPolicy, canCreateChannel: boolean, canCreateGroup: boolean, isAdmin: boolean) =>
1210
(!room.default || isAdmin) && ((room.t === 'p' && canCreateChannel) || (room.t === 'c' && canCreateGroup));
1311

1412
export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) => {
1513
const isAdmin = useRole('admin');
16-
const e2eeState = useE2EEState();
17-
const isE2EEReady = e2eeState === E2EEState.READY || e2eeState === E2EEState.SAVE_PASSWORD;
1814
const canCreateChannel = usePermission('create-c');
1915
const canCreateGroup = usePermission('create-p');
2016

@@ -37,7 +33,6 @@ export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) =
3733
useMemo(() => ['archive-room', 'unarchive-room'], []),
3834
room._id,
3935
);
40-
const canToggleEncryption = usePermission('toggle-room-e2e-encryption', room._id) && (room.encrypted || isE2EEReady);
4136

4237
const [
4338
canViewName,
@@ -50,7 +45,6 @@ export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) =
5045
canViewHideSysMes,
5146
canViewJoinCode,
5247
canViewReactWhenReadOnly,
53-
canViewEncrypted,
5448
] = useMemo(() => {
5549
const isAllowed =
5650
roomCoordinator.getRoomDirectives(room.t)?.allowRoomSettingChange ||
@@ -68,7 +62,6 @@ export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) =
6862
isAllowed(room, RoomSettingsEnum.SYSTEM_MESSAGES),
6963
isAllowed(room, RoomSettingsEnum.JOIN_CODE),
7064
isAllowed(room, RoomSettingsEnum.REACT_WHEN_READ_ONLY),
71-
isAllowed(room, RoomSettingsEnum.E2E),
7265
];
7366
}, [room]);
7467

@@ -78,7 +71,6 @@ export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) =
7871
canSetReactWhenReadOnly,
7972
canEditRoomRetentionPolicy,
8073
canArchiveOrUnarchive,
81-
canToggleEncryption,
8274
canViewName,
8375
canViewTopic,
8476
canViewAnnouncement,
@@ -89,6 +81,5 @@ export const useEditRoomPermissions = (room: IRoom | IRoomWithRetentionPolicy) =
8981
canViewHideSysMes,
9082
canViewJoinCode,
9183
canViewReactWhenReadOnly,
92-
canViewEncrypted,
9384
};
9485
};

apps/meteor/tests/e2e/e2e-encryption.spec.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -545,26 +545,6 @@ test.describe.serial('e2e-encryption', () => {
545545
await expect(channelMention).toBeVisible();
546546
});
547547

548-
test('should encrypted field be available on edit room', async ({ page }) => {
549-
const channelName = faker.string.uuid();
550-
551-
await poHomeChannel.sidenav.openNewByLabel('Channel');
552-
await poHomeChannel.sidenav.inputChannelName.fill(channelName);
553-
await poHomeChannel.sidenav.btnCreate.click();
554-
555-
await expect(page).toHaveURL(`/group/${channelName}`);
556-
557-
await expect(poHomeChannel.toastSuccess).toBeVisible();
558-
559-
await poHomeChannel.dismissToast();
560-
561-
await poHomeChannel.tabs.btnRoomInfo.click();
562-
await poHomeChannel.tabs.room.btnEdit.click();
563-
await poHomeChannel.tabs.room.advancedSettingsAccordion.click();
564-
565-
await expect(poHomeChannel.tabs.room.checkboxEncrypted).toBeVisible();
566-
});
567-
568548
test('expect create a Direct message, encrypt it and attempt to enable OTR', async ({ page }) => {
569549
await poHomeChannel.sidenav.openNewByLabel('Direct message');
570550
await poHomeChannel.sidenav.inputDirectUsername.click();

apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ export class HomeFlextabRoom {
7979
return this.page.locator('label', { has: this.page.getByRole('checkbox', { name: 'Read-only' }) });
8080
}
8181

82-
get checkboxEncrypted(): Locator {
83-
return this.page.locator('label', { has: this.page.getByRole('checkbox', { name: 'Encrypted' }) });
84-
}
85-
8682
get btnSave(): Locator {
8783
return this.page.locator('role=button[name="Save"]');
8884
}

0 commit comments

Comments
 (0)