From ae1ba7149df4a45b26e1d2485300d4f79e803055 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Tue, 25 Nov 2025 15:22:20 +0100 Subject: [PATCH] Added possibility to Drag&Drop message selection between folders. fix #3775 --- frontend/src/api/webmail.js | 20 ++- frontend/src/components/webmail/EmailList.vue | 114 ++++++++++++------ .../src/components/webmail/MailboxList.vue | 32 ++++- .../src/layouts/connected/ConnectedLayout.vue | 8 +- frontend/src/stores/bus.store.js | 14 ++- frontend/src/stores/index.js | 1 + frontend/src/stores/webmail.store.js | 12 ++ frontend/yarn.lock | 5 + modoboa/webmail/serializers.py | 3 +- modoboa/webmail/tests/test_viewsets.py | 24 +++- modoboa/webmail/viewsets.py | 20 ++- 11 files changed, 195 insertions(+), 58 deletions(-) create mode 100644 frontend/src/stores/webmail.store.js diff --git a/frontend/src/api/webmail.js b/frontend/src/api/webmail.js index 067b42a2b..6ee58d7e7 100644 --- a/frontend/src/api/webmail.js +++ b/frontend/src/api/webmail.js @@ -65,23 +65,31 @@ export default { responseType: 'blob', }) }, - deleteSelection(mailbox, selection) { + moveSelection(source, destination, selection) { const body = { - mailbox, + source, + destination, + selection, + } + return repository.post('/webmail/emails/move/', body) + }, + deleteSelection(source, selection) { + const body = { + source, selection, } return repository.post('/webmail/emails/delete/', body) }, - markSelectionAsJunk(mailbox, selection) { + markSelectionAsJunk(source, selection) { const body = { - mailbox, + source, selection, } return repository.post('/webmail/emails/mark_as_junk/', body) }, - markSelectionAsNotJunk(mailbox, selection) { + markSelectionAsNotJunk(source, selection) { const body = { - mailbox, + source, selection, } return repository.post('/webmail/emails/mark_as_not_junk/', body) diff --git a/frontend/src/components/webmail/EmailList.vue b/frontend/src/components/webmail/EmailList.vue index 45da064a2..85ce9a249 100644 --- a/frontend/src/components/webmail/EmailList.vue +++ b/frontend/src/components/webmail/EmailList.vue @@ -5,6 +5,7 @@ v-model="selectAll" class="mr-4" hide-details + color="primary" @update:model-value="toggleAllSelection" /> @@ -88,7 +89,7 @@ -
+
{{ emails.first_index }}-{{ emails.last_index }} {{ $gettext('on') }} {{ emails.count }} @@ -119,14 +120,17 @@ :key="email.imapid" density="compact" class="mb-2 mx-1" + draggable="true" + @dragstart="onDragStart(email)" >