fix(encryption): Clicking on default module sets bogus value

Fixes #44532 
Helps with #43123 

Also adds a warning so that people aren't confused when the "Enable server-side encryption" toggle can't be toggled anymore after encryption is enabled.

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2024-04-01 17:27:50 -04:00 committed by GitHub
parent 536aa8ae87
commit c9ba8fc39f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,8 +22,14 @@
<template>
<NcSettingsSection :name="t('settings', 'Server-side encryption')"
:description="t('settings', 'Server-side encryption makes it possible to encrypt files which are uploaded to this server. This comes with limitations like a performance penalty, so enable this only if needed.')"
:description="t('settings', 'Server-side encryption makes it possible to encrypt files which are uploaded to this server.')"
:doc-url="encryptionAdminDoc">
<NcNoteCard type="info">
<p>This comes with limitations like a performance penalty, so enable this only if needed.</p>
</NcNoteCard>
<NcNoteCard type="warning">
<p>Once enabled, server-side encryption cannot be toggled off here. Disabling encryption requires command line access.</p>
</NcNoteCard>
<NcCheckboxRadioSwitch :checked="encryptionEnabled || shouldDisplayWarning"
:disabled="encryptionEnabled"
type="switch"
@ -137,10 +143,9 @@ export default {
key,
})
const stringValue = value ? 'yes' : 'no'
try {
const { data } = await axios.post(url, {
value: stringValue,
value: value,
})
this.handleResponse({
status: data.ocs?.meta?.status,
@ -157,7 +162,7 @@ export default {
},
async enableEncryption() {
this.encryptionEnabled = true
await this.update('encryption_enabled', true)
await this.update('encryption_enabled', 'yes')
},
async handleResponse({ status, errorMessage, error }) {
if (status !== 'ok') {