Webmail fixes

This commit is contained in:
Antoine Nguyen
2026-02-03 11:50:01 +01:00
parent b0438cd03c
commit 01b4527f5f
5 changed files with 30 additions and 16 deletions
@@ -68,7 +68,7 @@
<v-combobox
v-model="form.to"
:items="contacts"
item-title="display_name"
:item-title="(item) => getItemTitle(item)"
return-object
:placeholder="$gettext('Provide one or more addresses')"
variant="outlined"
@@ -217,7 +217,7 @@ const emit = defineEmits(['onToggleHtmlMode'])
const route = useRoute()
const router = useRouter()
const { $gettext } = useGettext()
const { displayNotification } = useBusStore()
const { displayNotification, reloadData } = useBusStore()
const authStore = useAuthStore()
const allowedSenders = ref([])
@@ -266,7 +266,7 @@ const initForm = () => {
}
}
const submit = async () => {
const submit = async (reload) => {
const { valid } = await formRef.value.validate()
if (!valid) {
return
@@ -298,7 +298,10 @@ const submit = async () => {
router.push({ name: 'MailboxView' })
const msg = body.scheduled_datetime
? $gettext('Email scheduled')
: $gettext('Email seng')
: $gettext('Email sent')
if (reload) {
reloadData()
}
displayNotification({ msg })
} catch (error) {
console.log(error)
@@ -309,7 +312,7 @@ const submit = async () => {
const scheduleAndSubmit = async (datetime) => {
form.value.scheduled_datetime = datetime
await submit()
await submit(true)
}
const openAttachmentsDialog = () => {
@@ -326,8 +329,8 @@ const lookForContacts = debounce(async (search) => {
if (search) {
const params = { search }
const resp = await contactsApi.getContacts(params)
if (resp.data.length) {
contacts.value = resp.data
if (resp.data.count > 0) {
contacts.value = resp.data.results
}
} else {
contacts.value = []
@@ -360,6 +363,13 @@ const closeSchedulingForm = () => {
showSchedulingForm.value = false
}
const getItemTitle = (item) => {
if (typeof item === 'string') {
return item
}
return item.display_name || `${item.first_name} ${item.last_name}`
}
watch(
() => props.originalEmail,
() => {
@@ -251,7 +251,7 @@ const props = defineProps({
})
const { $gettext, $ngettext } = useGettext()
const { displayNotification, reloadMailboxCounters, reloadData } = useBusStore()
const { displayNotification, reloadMailboxCounters } = useBusStore()
const webmailStore = useWebmailStore()
const router = useRouter()
const route = useRoute()
@@ -324,7 +324,6 @@ const updateScheduledEmail = async (datetime) => {
selectedScheduledEmail.value.scheduled_id,
data
)
reloadData()
fetchEmails()
displayNotification({ msg: $gettext('Scheduling updated') })
}
@@ -146,6 +146,8 @@ const mailboxQuotaTitle = computed(() => {
return `${mailboxQuota.value.current} / ${mailboxQuota.value.limit} (${mailboxQuota.value.usage}%)`
})
const dataKey = computed(() => busStore.dataKey)
function openMailbox(mailbox) {
router.push({
name: 'MailboxView',
@@ -212,12 +214,9 @@ const deleteMailbox = async () => {
navigateToMailbox('INBOX')
}
watch(
() => busStore.dataKey,
() => {
fetchUserMailboxes()
}
)
watch(dataKey, () => {
fetchUserMailboxes()
})
await fetchUserMailboxes()
const resp = await api.getUserMailboxQuota(route.query.mailbox || 'INBOX')
+1 -1
View File
@@ -23,7 +23,7 @@ function samePassword(value, confirmation) {
}
function validateTime(value) {
if (!/^([01]\d|2[0-3]):?([0-5]\d)$/.test(value)) {
if (!/^([01]?\d|2[0-3]):?([0-5]\d)$/.test(value)) {
return $gettext('Not a valid time')
}
return true