Implement switch value submission in mail settings

This commit is contained in:
Johannes Zellner
2025-03-09 20:55:58 +01:00
parent 40dcbd1229
commit 4d7a5f03ab
+27 -3
View File
@@ -131,6 +131,30 @@ async function onSendTestMail(domain) {
window.pankow.notify({ text: 'Mail sent', type: 'success' });
}
async function onChangeMailboxSharing(value) {
const [error] = await mailModel.setMailboxSharing(value);
if (error) {
mailboxSharingEnabled.value = !value;
return console.error(error);
}
}
async function onChangeVirtualAllMail(value) {
const [error] = await mailModel.setVirtualAllMail(value);
if (error) {
virtualAllMailEnabled.value = !value;
return console.error(error);
}
}
async function onChangeFts(value) {
const [error] = await mailModel.setFtsConfig(value);
if (error) {
ftsEnabled.value = !value;
return console.error(error);
}
}
onMounted(async () => {
let [error, result] = await profileModel.get();
if (error) return console.error(error);
@@ -246,7 +270,7 @@ onMounted(async () => {
<label>{{ $t('emails.mailboxSharing.title') }}</label>
<div>{{ $t('emails.mailboxSharing.description') }}</div>
</FormGroup>
<Switch v-model="mailboxSharingEnabled"/>
<Switch v-model="mailboxSharingEnabled" @change="onChangeMailboxSharing"/>
</SettingsItem>
<SettingsItem>
@@ -254,7 +278,7 @@ onMounted(async () => {
<label>{{ $t('emails.settings.virtualAllMail') }}</label>
<div v-html="$t('emails.changeVirtualAllMailDialog.description')"></div>
</FormGroup>
<Switch v-model="virtualAllMailEnabled"/>
<Switch v-model="virtualAllMailEnabled" @change="onChangeVirtualAllMail"/>
</SettingsItem>
<SettingsItem>
@@ -274,7 +298,7 @@ onMounted(async () => {
<label>{{ $t('emails.settings.solrFts') }}</label>
<div v-html="$t('emails.solrConfig.description')"></div>
</FormGroup>
<Switch v-model="ftsEnabled"/>
<Switch v-model="ftsEnabled" @change="onChangeFts"/>
</SettingsItem>
<SettingsItem>