diff --git a/.changeset/force-e2ee-private-rooms.md b/.changeset/force-e2ee-private-rooms.md new file mode 100644 index 0000000000000..48f3320f567e3 --- /dev/null +++ b/.changeset/force-e2ee-private-rooms.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/meteor': minor +'@rocket.chat/i18n': minor +--- + +Adds a workspace setting **Force end-to-end encryption on private rooms** (`E2E_Force_Encryption_For_Private_Rooms`) under **Admin → Settings → End-to-End Encryption**. When enabled, every newly created private room is encrypted by default and users can no longer opt out: the encryption toggle in the create-room modal is locked on for private rooms, and the server rejects any attempt to create a private room with `encrypted: false` (e.g. via `groups.create`) with the error `error-encrypted-private-rooms-enforced`. Public rooms are unaffected. Federated rooms are exempt since federation does not support E2EE. Creating a discussion under an unencrypted private parent room is rejected with a dedicated error instructing the user to make the parent public or enable encryption on it, and the create-discussion dialog now surfaces creation errors as toasts. diff --git a/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx b/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx index c7916e1063a5f..9ee81888019e2 100644 --- a/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx +++ b/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx @@ -13,7 +13,7 @@ import { } from '@rocket.chat/fuselage-forms'; import { useStableCallback } from '@rocket.chat/fuselage-hooks'; import { GenericModal } from '@rocket.chat/ui-client'; -import { useTranslation, useEndpoint } from '@rocket.chat/ui-contexts'; +import { useTranslation, useEndpoint, useToastMessageDispatch } from '@rocket.chat/ui-contexts'; import { useMutation } from '@tanstack/react-query'; import { useState } from 'react'; import { useForm, Controller } from 'react-hook-form'; @@ -82,6 +82,7 @@ const CreateDiscussion = ({ const createDiscussion = useEndpoint('POST', '/v1/rooms.createDiscussion'); const goToRoom = useGoToRoom(); + const dispatchToastMessage = useToastMessageDispatch(); const createDiscussionMutation = useMutation({ mutationFn: createDiscussion, @@ -89,6 +90,9 @@ const CreateDiscussion = ({ goToRoom(discussion._id); onClose(); }, + onError: (error) => { + dispatchToastMessage({ type: 'error', message: error }); + }, }); const handleCreate = async ({ name, parentRoom, encrypted, usernames, firstMessage, topic }: CreateDiscussionFormValues) => { diff --git a/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap b/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap index edfe285014aa1..264715937fd53 100644 --- a/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap +++ b/apps/meteor/client/components/CreateDiscussion/__snapshots__/CreateDiscussion.spec.tsx.snap @@ -77,7 +77,7 @@ exports[`CreateDiscussion renders Default without crashing 1`] = ` class="rcx-box rcx-box--full rcx-field__row" >
@@ -200,7 +200,7 @@ exports[`CreateDiscussion renders Default without crashing 1`] = ` class="rcx-box rcx-box--full rcx-field__row" >