email: fix masquerade toggle
This commit is contained in:
@@ -112,20 +112,20 @@ async function onEnableIncoming() {
|
||||
}
|
||||
|
||||
|
||||
const mailFromValidation = ref(false);
|
||||
const mailFromValidationBusy = ref(false);
|
||||
const customFrom = ref(false);
|
||||
const customFromBusy = ref(false);
|
||||
|
||||
async function onToggleMailFromValidation(value) {
|
||||
mailFromValidationBusy.value = true;
|
||||
async function onToggleCustomFrom(value) {
|
||||
customFromBusy.value = true;
|
||||
|
||||
const [error] = await mailModel.setMailFromValidation(domain.value, value);
|
||||
const [error] = await mailModel.setMailFromValidation(domain.value, !value); // note: inverted logic between UI switch and API
|
||||
if (error) {
|
||||
mailFromValidation.value = !value;
|
||||
mailFromValidationBusy.value = false;
|
||||
customFrom.value = !value; // revert back old value
|
||||
customFromBusy.value = false;
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
mailFromValidationBusy.value = false;
|
||||
customFromBusy.value = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ async function onDomainChanged() {
|
||||
mailConfig.value = result;
|
||||
inboundEnabled.value = result.enabled;
|
||||
outboundEnabled.value = result.relay?.provider !== 'noop';
|
||||
mailFromValidation.value = result.mailFromValidation;
|
||||
customFrom.value = !result.mailFromValidation; // note: inverted logic between UI switch and API
|
||||
signatureText.value = mailConfig.value.banner.text || '';
|
||||
signatureHtml.value = mailConfig.value.banner.html || '';
|
||||
|
||||
@@ -289,10 +289,10 @@ onMounted(async () => {
|
||||
|
||||
<SettingsItem>
|
||||
<FormGroup>
|
||||
<label>{{ $t('email.masquerading.title') }}</label>
|
||||
<div v-html="$t('email.masquerading.description')"></div>
|
||||
<label>{{ $t('email.customFrom.title') }}</label>
|
||||
<div v-html="$t('email.customFrom.description')"></div>
|
||||
</FormGroup>
|
||||
<Switch v-model="mailFromValidation" @change="onToggleMailFromValidation" :disabled="mailFromValidationBusy"/>
|
||||
<Switch v-model="customFrom" @change="onToggleCustomFrom" :disabled="customFromBusy"/>
|
||||
</SettingsItem>
|
||||
|
||||
<SettingsItem>
|
||||
|
||||
Reference in New Issue
Block a user