-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: E2EE room's
Key
icon no longer toggles encryption of room (#…
…33572) Co-authored-by: Aleksander Nicacio da Silva <aleksander.silva@rocket.chat>
- Loading branch information
Showing
23 changed files
with
23 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rocket.chat/meteor": major | ||
"@rocket.chat/i18n": patch | ||
--- | ||
|
||
Removes the ability of changing room's encryption status from the `key` icon placed on the room's header. Icon's purpose is now only informative, showing when a room uses E2EE. Use the kebab menu to enable/disable E2EE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,14 @@ | ||
import type { IRoom } from '@rocket.chat/core-typings'; | ||
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; | ||
import colors from '@rocket.chat/fuselage-tokens/colors'; | ||
import { useSetting, usePermission, useTranslation, useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import { useSetting, useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { memo } from 'react'; | ||
|
||
import { HeaderState } from '../../../../components/Header'; | ||
import { dispatchToastMessage } from '../../../../lib/toast'; | ||
|
||
const Encrypted = ({ room }: { room: IRoom }) => { | ||
const t = useTranslation(); | ||
const e2eEnabled = useSetting('E2E_Enable'); | ||
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(async () => { | ||
if (!canToggleE2E) { | ||
return; | ||
} | ||
|
||
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.g500} tiny /> | ||
) : null; | ||
return e2eEnabled && room?.encrypted ? <HeaderState title={t('Encrypted')} icon='key' color={colors.g500} tiny /> : null; | ||
}; | ||
|
||
export default memo(Encrypted); |
26 changes: 2 additions & 24 deletions
26
apps/meteor/client/views/room/HeaderV2/icons/Encrypted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,14 @@ | ||
import type { IRoom } from '@rocket.chat/core-typings'; | ||
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; | ||
import colors from '@rocket.chat/fuselage-tokens/colors'; | ||
import { useSetting, usePermission, useTranslation, useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import { useSetting, useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { memo } from 'react'; | ||
|
||
import { HeaderState } from '../../../../components/Header'; | ||
import { dispatchToastMessage } from '../../../../lib/toast'; | ||
|
||
const Encrypted = ({ room }: { room: IRoom }) => { | ||
const t = useTranslation(); | ||
const e2eEnabled = useSetting('E2E_Enable'); | ||
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(async () => { | ||
if (!canToggleE2E) { | ||
return; | ||
} | ||
|
||
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.g500} tiny /> | ||
) : null; | ||
return e2eEnabled && room?.encrypted ? <HeaderState title={t('Encrypted')} icon='key' color={colors.g500} tiny /> : null; | ||
}; | ||
|
||
export default memo(Encrypted); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters