From f87f286b80edbfbdd825758dc4edbdf171b7f194 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Thu, 21 Sep 2023 14:39:40 +0200 Subject: [PATCH] webmail: dragging works on selected items, so tell user they cannot drag if they try to drag a non-selected message --- webmail/webmail.js | 5 +++++ webmail/webmail.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/webmail/webmail.js b/webmail/webmail.js index c13fc2a..707ccf2 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -2427,6 +2427,11 @@ const newMsgitemView = (mi, msglistView, otherMailbox, listMailboxes, receivedTi const active = msgitemView.root && msgitemView.root.classList.contains('active'); const focus = msgitemView.root && msgitemView.root.classList.contains('focus'); const elem = dom.div(dom._class('msgitem'), active ? dom._class('active') : [], focus ? dom._class('focus') : [], attr.draggable('true'), function dragstart(e) { + if (!msglistView.selected().includes(msgitemView)) { + e.preventDefault(); + window.alert('Can only drag items in selection.'); + return; + } // We send the Message.ID and MailboxID, so we can decide based on the destination // mailbox whether to move. We don't move messages already in the destination // mailbox, and also skip messages in the Sent mailbox when there are also messages diff --git a/webmail/webmail.ts b/webmail/webmail.ts index 540e28e..c7795f2 100644 --- a/webmail/webmail.ts +++ b/webmail/webmail.ts @@ -1835,6 +1835,11 @@ const newMsgitemView = (mi: api.MessageItem, msglistView: MsglistView, otherMail focus ? dom._class('focus') : [], attr.draggable('true'), function dragstart(e: DragEvent) { + if (!msglistView.selected().includes(msgitemView)) { + e.preventDefault() + window.alert('Can only drag items in selection.') + return + } // We send the Message.ID and MailboxID, so we can decide based on the destination // mailbox whether to move. We don't move messages already in the destination // mailbox, and also skip messages in the Sent mailbox when there are also messages