Skip to content

Commit

Permalink
hide irrelevant advanced settings for chatmail users
Browse files Browse the repository at this point in the history
fix #3819
  • Loading branch information
Simon-Laux committed May 15, 2024
1 parent 018e87b commit 690f540
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- Update `@deltachat/stdio-rpc-server` and `deltachat/jsonrpc-client` to `v1.138.0`
- upgrade `electron` from `28.2.3` to `30.0.2`
- increase minimum nodejs version from `18` to `20`
- hide irrelevant advanced settings for chatmail users

### Fixed
- fix chat audit dialog was going out of viewport on smaller screens #3736
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/components/Settings/Advanced.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Advanced({ settingsStore }: Props) {
<SettingsSeparator />

<SettingsHeading>{tx('pref_encryption')}</SettingsHeading>
<Encryption />
<Encryption settingsStore={settingsStore} />
<SettingsSeparator />

<SettingsHeading>{tx('pref_server')}</SettingsHeading>
Expand All @@ -43,7 +43,9 @@ export default function Advanced({ settingsStore }: Props) {
>
{tx('pref_password_and_account_settings')}
</SettingsButton>
<ImapFolderHandling settingsStore={settingsStore} />
{!settingsStore.settings.is_chatmail && (
<ImapFolderHandling settingsStore={settingsStore} />
)}
</>
)
}
17 changes: 12 additions & 5 deletions src/renderer/components/Settings/Encryption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,24 @@ import useDialog from '../../hooks/dialog/useDialog'

import type { DialogProps } from '../../contexts/DialogContext'
import ManageKeys from './ManageKeys'
import { SettingsStoreState } from '../../stores/settings'

export default function Encryption() {
type Props = {
settingsStore: SettingsStoreState
}

export default function Encryption({ settingsStore }: Props) {
const { openDialog } = useDialog()
const tx = useTranslationFunction()

return (
<>
<CoreSettingsSwitch
settingsKey='e2ee_enabled'
label={tx('autocrypt_prefer_e2ee')}
/>
{!settingsStore.settings.is_chatmail && (
<CoreSettingsSwitch
settingsKey='e2ee_enabled'
label={tx('autocrypt_prefer_e2ee')}
/>
)}
<ManageKeys />
<SettingsButton onClick={() => openDialog(SendAutocryptSetupMessage)}>
{tx('autocrypt_send_asm_button')}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface SettingsStoreState {
only_fetch_mvbox: string
disable_idle: string
media_quality: string
is_chatmail: string
}
desktopSettings: DesktopSettingsType
rc: RC_Config
Expand All @@ -48,6 +49,7 @@ const settingsKeys: Array<keyof SettingsStoreState['settings']> = [
'only_fetch_mvbox',
'disable_idle',
'media_quality',
'is_chatmail',
]

class SettingsStore extends Store<SettingsStoreState | null> {
Expand Down

0 comments on commit 690f540

Please sign in to comment.