mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-21 10:24:05 +01:00
Merge pull request #3940 from modoboa/fix/email-reply
Do not load message from Drafts folder when replying.
This commit is contained in:
@@ -202,6 +202,7 @@ import { ref, watch } from 'vue'
|
|||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useGettext } from 'vue3-gettext'
|
import { useGettext } from 'vue3-gettext'
|
||||||
import { useAuthStore, useBusStore } from '@/stores'
|
import { useAuthStore, useBusStore } from '@/stores'
|
||||||
|
import constants from '@/constants.json'
|
||||||
import debounce from 'debounce'
|
import debounce from 'debounce'
|
||||||
import AttachmentsDialog from '@/components/webmail/AttachmentsDialog'
|
import AttachmentsDialog from '@/components/webmail/AttachmentsDialog'
|
||||||
import BodyEditor from '@/components/webmail/BodyEditor'
|
import BodyEditor from '@/components/webmail/BodyEditor'
|
||||||
@@ -356,9 +357,12 @@ const lookForContacts = debounce(async (search) => {
|
|||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
const initialize = async (body) => {
|
const initialize = async (body) => {
|
||||||
if (route.query.mailid) {
|
if (route.params.mailbox === constants.DRAFTS_FOLDER && route.query.mailid) {
|
||||||
// Load draft
|
// 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
|
form.value.sender = draft.data.from_address.address
|
||||||
if (draft.data.to?.length) {
|
if (draft.data.to?.length) {
|
||||||
form.value.to = draft.data.to.map((rcpt) => rcpt.address)
|
form.value.to = draft.data.to.map((rcpt) => rcpt.address)
|
||||||
@@ -430,7 +434,9 @@ watch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!route.query.uid) {
|
if (!route.query.uid) {
|
||||||
api.createComposeSession(route.query.mailid).then((resp) => {
|
const args =
|
||||||
|
route.query.mailbox === constants.DRAFTS_FOLDER ? [route.query.mailid] : []
|
||||||
|
api.createComposeSession(...args).then((resp) => {
|
||||||
const query = { ...route.query, uid: resp.data.uid }
|
const query = { ...route.query, uid: resp.data.uid }
|
||||||
attachmentCount.value = resp.data.attachments?.length || 0
|
attachmentCount.value = resp.data.attachments?.length || 0
|
||||||
router.push({ name: route.name, query })
|
router.push({ name: route.name, query })
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
"SUPER_ADMIN": "SuperAdmins",
|
"SUPER_ADMIN": "SuperAdmins",
|
||||||
"RESELLER": "Resellers",
|
"RESELLER": "Resellers",
|
||||||
"DOMAIN_ADMIN": "DomainAdmins",
|
"DOMAIN_ADMIN": "DomainAdmins",
|
||||||
"USER": "SimpleUsers"
|
"USER": "SimpleUsers",
|
||||||
|
"DRAFTS_FOLDER": "Drafts"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
>
|
>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="route.query.mailbox === 'Drafts'"
|
v-if="route.query.mailbox === constants.DRAFTS_FOLDER"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
variant="tonal"
|
variant="tonal"
|
||||||
icon="mdi-pencil"
|
icon="mdi-pencil"
|
||||||
@@ -177,6 +177,7 @@ import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useGettext } from 'vue3-gettext'
|
import { useGettext } from 'vue3-gettext'
|
||||||
import { useBusStore } from '@/stores'
|
import { useBusStore } from '@/stores'
|
||||||
|
import constants from '@/constants.json'
|
||||||
import api from '@/api/webmail'
|
import api from '@/api/webmail'
|
||||||
import ContactCard from '@/components/webmail/ContactCard.vue'
|
import ContactCard from '@/components/webmail/ContactCard.vue'
|
||||||
|
|
||||||
|
|||||||
@@ -783,6 +783,8 @@ class IMAPconnector:
|
|||||||
bcmd = "BODY.PEEK" if readonly else "BODY"
|
bcmd = "BODY.PEEK" if readonly else "BODY"
|
||||||
to_fetch = f"(BODYSTRUCTURE {bcmd}[HEADER.FIELDS ({what})])"
|
to_fetch = f"(BODYSTRUCTURE {bcmd}[HEADER.FIELDS ({what})])"
|
||||||
data = self._cmd("FETCH", mailid, to_fetch)
|
data = self._cmd("FETCH", mailid, to_fetch)
|
||||||
|
if int(mailid) not in data:
|
||||||
|
raise ImapError(f"Message with UID {mailid} not found in {mbox} folder")
|
||||||
return data[int(mailid)]
|
return data[int(mailid)]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user