diff --git a/frontend/src/components/webmail/ComposeEmailForm.vue b/frontend/src/components/webmail/ComposeEmailForm.vue index cc483b04f..bc16e809a 100644 --- a/frontend/src/components/webmail/ComposeEmailForm.vue +++ b/frontend/src/components/webmail/ComposeEmailForm.vue @@ -202,6 +202,7 @@ import { ref, watch } from 'vue' import { useRoute, useRouter } from 'vue-router' import { useGettext } from 'vue3-gettext' import { useAuthStore, useBusStore } from '@/stores' +import constants from '@/constants.json' import debounce from 'debounce' import AttachmentsDialog from '@/components/webmail/AttachmentsDialog' import BodyEditor from '@/components/webmail/BodyEditor' @@ -356,9 +357,12 @@ const lookForContacts = debounce(async (search) => { }, 500) const initialize = async (body) => { - if (route.query.mailid) { + if (route.params.mailbox === constants.DRAFTS_FOLDER && route.query.mailid) { // Load draft - const draft = await api.getEmailContent('Drafts', route.query.mailid) + const draft = await api.getEmailContent( + constants.DRAFTS_FOLDER, + route.query.mailid + ) form.value.sender = draft.data.from_address.address if (draft.data.to?.length) { form.value.to = draft.data.to.map((rcpt) => rcpt.address) @@ -430,7 +434,10 @@ watch( ) if (!route.query.uid) { - api.createComposeSession(route.query.mailid).then((resp) => { + const args = + route.query.mailbox === constants.DRAFTS_FOLDER ? [route.query.mailid] : [] + console.log(args) + api.createComposeSession(...args).then((resp) => { const query = { ...route.query, uid: resp.data.uid } attachmentCount.value = resp.data.attachments?.length || 0 router.push({ name: route.name, query }) diff --git a/frontend/src/constants.json b/frontend/src/constants.json index 7b4066720..63bc3bfba 100644 --- a/frontend/src/constants.json +++ b/frontend/src/constants.json @@ -4,5 +4,6 @@ "SUPER_ADMIN": "SuperAdmins", "RESELLER": "Resellers", "DOMAIN_ADMIN": "DomainAdmins", - "USER": "SimpleUsers" + "USER": "SimpleUsers", + "DRAFTS_FOLDER": "Drafts" } diff --git a/frontend/src/views/webmail/EmailView.vue b/frontend/src/views/webmail/EmailView.vue index 0281bcc3a..2bbc58675 100644 --- a/frontend/src/views/webmail/EmailView.vue +++ b/frontend/src/views/webmail/EmailView.vue @@ -54,7 +54,7 @@ >