fix: SMTP shouldn't be configurable without IMAP enabled (#4428)

* fix: Configure SMTP only if IMAP is enabled
This commit is contained in:
Aswin Dev P.S 2022-04-11 12:35:03 +05:30 committed by GitHub
parent b1efcde495
commit f1ae09d21b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View file

@ -7,6 +7,10 @@
<p class="sub-head"> <p class="sub-head">
{{ subTitle }} {{ subTitle }}
</p> </p>
<p v-if="note">
<span class="note">{{ $t('INBOX_MGMT.NOTE') }}</span>
{{ note }}
</p>
</div> </div>
<div class="medium-6 small-12"> <div class="medium-6 small-12">
<slot></slot> <slot></slot>
@ -25,6 +29,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
note: {
type: String,
default: '',
},
}, },
}; };
</script> </script>
@ -46,5 +54,9 @@ export default {
.title--section { .title--section {
padding-right: var(--space-large); padding-right: var(--space-large);
} }
.note {
font-weight: var(--font-weight-bold);
}
} }
</style> </style>

View file

@ -470,6 +470,7 @@
"IMAP": { "IMAP": {
"TITLE": "IMAP", "TITLE": "IMAP",
"SUBTITLE": "Set your IMAP details", "SUBTITLE": "Set your IMAP details",
"NOTE_TEXT": "To enable SMTP, please configure IMAP.",
"UPDATE": "Update IMAP settings", "UPDATE": "Update IMAP settings",
"TOGGLE_AVAILABILITY": "Enable IMAP configuration for this inbox", "TOGGLE_AVAILABILITY": "Enable IMAP configuration for this inbox",
"TOGGLE_HELP": "Enabling IMAP will help the user to recieve email", "TOGGLE_HELP": "Enabling IMAP will help the user to recieve email",
@ -529,6 +530,7 @@
"SSL_TLS": "SSL/TLS", "SSL_TLS": "SSL/TLS",
"START_TLS": "STARTTLS", "START_TLS": "STARTTLS",
"OPEN_SSL_VERIFY_MODE": "Open SSL Verify Mode" "OPEN_SSL_VERIFY_MODE": "Open SSL Verify Mode"
} },
"NOTE": "Note: "
} }
} }

View file

@ -3,6 +3,7 @@
<settings-section <settings-section
:title="$t('INBOX_MGMT.IMAP.TITLE')" :title="$t('INBOX_MGMT.IMAP.TITLE')"
:sub-title="$t('INBOX_MGMT.IMAP.SUBTITLE')" :sub-title="$t('INBOX_MGMT.IMAP.SUBTITLE')"
:note="$t('INBOX_MGMT.IMAP.NOTE_TEXT')"
> >
<form @submit.prevent="updateInbox"> <form @submit.prevent="updateInbox">
<label for="toggle-imap-enable"> <label for="toggle-imap-enable">
@ -132,7 +133,7 @@ export default {
async updateInbox() { async updateInbox() {
try { try {
this.loading = true; this.loading = true;
const payload = { let payload = {
id: this.inbox.id, id: this.inbox.id,
formData: false, formData: false,
channel: { channel: {
@ -147,6 +148,11 @@ export default {
: undefined, : undefined,
}, },
}; };
if (!this.isIMAPEnabled) {
payload.channel.smtp_enabled = false;
}
await this.$store.dispatch('inboxes/updateInboxIMAP', payload); await this.$store.dispatch('inboxes/updateInboxIMAP', payload);
this.showAlert(this.$t('INBOX_MGMT.IMAP.EDIT.SUCCESS_MESSAGE')); this.showAlert(this.$t('INBOX_MGMT.IMAP.EDIT.SUCCESS_MESSAGE'));
} catch (error) { } catch (error) {

View file

@ -422,7 +422,7 @@
</settings-section> </settings-section>
</div> </div>
<imap-settings :inbox="inbox" /> <imap-settings :inbox="inbox" />
<smtp-settings :inbox="inbox" /> <smtp-settings v-if="inbox.imap_enabled" :inbox="inbox" />
</div> </div>
</div> </div>
<div v-if="selectedTabKey === 'preChatForm'"> <div v-if="selectedTabKey === 'preChatForm'">