webmail: dragging works on selected items, so tell user they cannot drag if they try to drag a non-selected message

This commit is contained in:
Mechiel Lukkien 2023-09-21 14:39:40 +02:00
parent 20f11409b6
commit f87f286b80
No known key found for this signature in database
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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