diff --git a/doc-ng/installation/upgrade.md b/doc-ng/installation/upgrade.md index 131ec7f35..190cc63b0 100644 --- a/doc-ng/installation/upgrade.md +++ b/doc-ng/installation/upgrade.md @@ -180,6 +180,7 @@ from modoboa.calendars import jobs as calendars_jobs from modoboa.core import jobs as core_jobs from modoboa.admin import jobs as admin_jobs from modoboa.maillog import jobs as maillog_jobs +from modoboa.webmail import jobs as webmail_jobs register(core_jobs.clean_logs, queue_name="modoboa", cron="0 0 * * *") @@ -198,6 +199,8 @@ register(maillog_jobs.update_statistics, queue_name="modoboa", cron="0 * * * *") register(calendars_jobs.generate_rights, queue_name="privileged", cron="*/2 * * * *") +register(webmail_jobs.send_scheduled_messages, queue_name="modoboa", cron="* * * * *") + if "modoboa.amavis" in settings.MODOBOA_APPS: register(amavis_jobs.qcleanup, queue_name="modoboa", cron="0 0 * * *") register(amavis_jobs.amnotify, queue_name="modoboa", cron="0 12 * * *") @@ -268,9 +271,6 @@ New built-in auto-configuration service. # Not used for Modoboa WebMail; configure that in the Modoboa admin settings. # # * HOSTNAME: External hostname that clients should connect to - # * Supports Thunderbird-style placeholders to substitute values from the - # email address originally entered into the mail client: - # %EMAILADDRESS%, %EMAILLOCALPART%, %EMAILDOMAIN% # * SOCKET_TYPE: Actually the encryption settings # * May be one of: 'SSL' (immediate TLS), 'STARTTLS' or 'plain' (bad) # * PORT: TCP port that the client should use when connecting to the server diff --git a/frontend/src/components/webmail/ComposeEmailForm.vue b/frontend/src/components/webmail/ComposeEmailForm.vue index 55a57d156..a7dae7816 100644 --- a/frontend/src/components/webmail/ComposeEmailForm.vue +++ b/frontend/src/components/webmail/ComposeEmailForm.vue @@ -318,8 +318,8 @@ const openAttachmentsDialog = () => { const closeAttachmentDialog = async () => { showAttachmentsDialog.value = false - const resp = await api.getUploadedAttachments(route.query.uid) - attachmentCount.value = resp.data.length + const resp = await api.getComposeSession(route.query.uid) + attachmentCount.value = resp.data.attachments.length } const lookForContacts = debounce(async (search) => { diff --git a/frontend/src/components/webmail/EmailList.vue b/frontend/src/components/webmail/EmailList.vue index e27a1ba39..25d56654e 100644 --- a/frontend/src/components/webmail/EmailList.vue +++ b/frontend/src/components/webmail/EmailList.vue @@ -251,7 +251,7 @@ const props = defineProps({ }) const { $gettext, $ngettext } = useGettext() -const { displayNotification, reloadMailboxCounters } = useBusStore() +const { displayNotification, reloadMailboxCounters, reloadData } = useBusStore() const webmailStore = useWebmailStore() const router = useRouter() const route = useRoute() @@ -324,6 +324,7 @@ const updateScheduledEmail = async (datetime) => { selectedScheduledEmail.value.scheduled_id, data ) + reloadData() fetchEmails() displayNotification({ msg: $gettext('Scheduling updated') }) } diff --git a/frontend/src/stores/bus.store.js b/frontend/src/stores/bus.store.js index 90462437f..198335e89 100644 --- a/frontend/src/stores/bus.store.js +++ b/frontend/src/stores/bus.store.js @@ -45,6 +45,7 @@ export const useBusStore = defineStore('bus', () => { reloadMailboxCounters, dataKey, mbCounterKey, + reloadData, $reset, } }) diff --git a/modoboa/core/commands/templates/cron_config.py.tpl b/modoboa/core/commands/templates/cron_config.py.tpl index a1af5ab83..f3c765285 100644 --- a/modoboa/core/commands/templates/cron_config.py.tpl +++ b/modoboa/core/commands/templates/cron_config.py.tpl @@ -7,6 +7,7 @@ from modoboa.calendars import jobs as calendars_jobs from modoboa.core import jobs as core_jobs from modoboa.admin import jobs as admin_jobs from modoboa.maillog import jobs as maillog_jobs +from modoboa.webmail import jobs as webmail_jobs register(core_jobs.clean_logs, queue_name="modoboa", cron="0 0 * * *") diff --git a/modoboa/core/commands/templates/settings.py.tpl b/modoboa/core/commands/templates/settings.py.tpl index 001b7682c..08f27a40b 100644 --- a/modoboa/core/commands/templates/settings.py.tpl +++ b/modoboa/core/commands/templates/settings.py.tpl @@ -43,9 +43,6 @@ SITE_ID = 1 # Not used for Modoboa WebMail; configure that in the Modoboa admin settings. # # * HOSTNAME: External hostname that clients should connect to -# * Supports Thunderbird-style placeholders to substitute values from the -# email address originally entered into the mail client: -# %EMAILADDRESS%, %EMAILLOCALPART%, %EMAILDOMAIN% # * SOCKET_TYPE: Actually the encryption settings # * May be one of: 'SSL' (immediate TLS), 'STARTTLS' or 'plain' (bad) # * PORT: TCP port that the client should use when connecting to the server diff --git a/modoboa/webmail/jobs.py b/modoboa/webmail/jobs.py index 4e48bcc80..ad55d8509 100644 --- a/modoboa/webmail/jobs.py +++ b/modoboa/webmail/jobs.py @@ -15,8 +15,9 @@ def send_scheduled_message(message_id: int): def send_scheduled_messages(): + now = timezone.now().replace(second=0, microsecond=0) messages = models.ScheduledMessage.objects.filter( - scheduled_datetime__lte=timezone.now(), + scheduled_datetime__lte=now, status=constants.SchedulingState.SCHEDULED.value, ) queue = django_rq.get_queue("modoboa") diff --git a/modoboa/webmail/lib/sendmail.py b/modoboa/webmail/lib/sendmail.py index 7635657e9..c75a5a102 100644 --- a/modoboa/webmail/lib/sendmail.py +++ b/modoboa/webmail/lib/sendmail.py @@ -65,10 +65,13 @@ def schedule_email( request, attributes: dict, attachments: list ) -> models.ScheduledMessage: """Schedule a new email sending.""" + scheduled_datetime = attributes["scheduled_datetime"].replace( + second=0, microsecond=0 + ) sched_msg = models.ScheduledMessage( account=request.user, sender=attributes["sender"], - scheduled_datetime=attributes["scheduled_datetime"], + scheduled_datetime=scheduled_datetime, to=",".join(attributes["to"]), subject=attributes.get("subject", ""), body=attributes.get("body", ""),