Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Auto-translate doesn't work on E2E rooms #30369

Merged
merged 33 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b5e885e
Do not allow enabling auto-translate in E2E rooms
matheusbsilva137 Sep 12, 2023
61ea63b
Disable autotranslate when E2E is enabled
matheusbsilva137 Sep 12, 2023
9655b88
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 Sep 13, 2023
7d2c64c
Add callout in auto-translate sidebar
matheusbsilva137 Sep 14, 2023
95f0cbc
Add toast messages
matheusbsilva137 Sep 14, 2023
ce51685
Add projection
matheusbsilva137 Sep 14, 2023
5eb5f60
Merge branch 'develop' into fix/autotranslate-e2e
matheusbsilva137 Sep 14, 2023
79cca2c
Create changesets
matheusbsilva137 Sep 14, 2023
8fe55c6
Close new toast message on e2e tests
matheusbsilva137 Sep 18, 2023
98e9612
Fix e2e tests
matheusbsilva137 Sep 18, 2023
728c48f
Add end-to-end test
matheusbsilva137 Sep 18, 2023
8cc9527
Merge branch 'develop' into fix/autotranslate-e2e
matheusbsilva137 Sep 18, 2023
19cfd8a
Fix typo
matheusbsilva137 Sep 18, 2023
7d03334
Fix another typo
matheusbsilva137 Sep 18, 2023
d4c524a
Merge branch 'develop' into fix/autotranslate-e2e
matheusbsilva137 Sep 18, 2023
3cb154f
add toast at encrypted icon btn
guijun13 Sep 19, 2023
e4f95c2
Display toast message when toggling E2E via icon
matheusbsilva137 Sep 19, 2023
da91b81
Merge branch 'develop' into fix/autotranslate-e2e
guijun13 Sep 19, 2023
cbcd5f3
Update Encrypted.tsx
matheusbsilva137 Sep 19, 2023
0bc546d
fix e2e typos in i18n
guijun13 Sep 19, 2023
3c68fcf
Merge branch 'fix/autotranslate-e2e' of https://github.com/RocketChat…
guijun13 Sep 19, 2023
026443d
Merge branch 'fix/autotranslate-e2e' of https://github.com/RocketChat…
matheusbsilva137 Sep 26, 2023
9e8b30a
Display two toasts when changing language or enabling autotranslate
matheusbsilva137 Sep 26, 2023
f394918
Only display toast after language is set
matheusbsilva137 Sep 26, 2023
536ee78
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 Sep 29, 2023
a63f67f
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
matheusbsilva137 Oct 5, 2023
189e447
Avoid expression in parameter of t-function
tassoevan Oct 10, 2023
591c07c
Avoid expression in parameter of t-function
tassoevan Oct 10, 2023
b16c11e
Add helper to dismiss toast in E2E tests
tassoevan Oct 10, 2023
1691b81
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into fix/…
tassoevan Oct 10, 2023
afc95a5
Merge branch 'develop' into fix/autotranslate-e2e
matheusbsilva137 Oct 10, 2023
a1e6e4a
Merge branch 'develop' into fix/autotranslate-e2e
matheusbsilva137 Oct 10, 2023
b0e578a
Merge branch 'develop' into fix/autotranslate-e2e
kodiakhq[bot] Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Display toast message when toggling E2E via icon
  • Loading branch information
matheusbsilva137 committed Sep 19, 2023
commit e4f95c258ef498e9020b8ae92c6a73d4c4dcf538
19 changes: 15 additions & 4 deletions apps/meteor/client/views/room/Header/icons/Encrypted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@ import type { IRoom } from '@rocket.chat/core-typings';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import colors from '@rocket.chat/fuselage-tokens/colors';
import { HeaderState } from '@rocket.chat/ui-client';
import { useSetting, usePermission, useMethod, useTranslation } from '@rocket.chat/ui-contexts';
import { useSetting, usePermission, useEndpoint, useTranslation } from '@rocket.chat/ui-contexts';
import React, { memo } from 'react';

import { dispatchToastMessage } from '../../../../lib/toast';

const Encrypted = ({ room }: { room: IRoom }) => {
const t = useTranslation();
const e2eEnabled = useSetting('E2E_Enable');
const toggleE2E = useMethod('saveRoomSettings');
const toggleE2E = useEndpoint('POST', '/v1/rooms.saveRoomSettings');
const canToggleE2E = usePermission('toggle-room-e2e-encryption');
const encryptedLabel = canToggleE2E ? t('Encrypted_key_title') : t('Encrypted');
const handleE2EClick = useMutableCallback(() => {
const handleE2EClick = useMutableCallback(async () => {
if (!canToggleE2E) {
return;
}
toggleE2E(room._id, 'encrypted', !room?.encrypted);

const { success } = await toggleE2E({ rid: room._id, encrypted: !room?.encrypted });
if (!success) {
return;
}

dispatchToastMessage({
type: 'success',
message: t('E2E_Encryption_disabled_for_room', { roomName: room.name }),
});
});
return e2eEnabled && room?.encrypted ? (
<HeaderState title={encryptedLabel} icon='key' onClick={handleE2EClick} color={colors.s500} tiny />
Expand Down