From 8ca8a38bb20269865483d2bcbd860e89f8d1dfdc Mon Sep 17 00:00:00 2001 From: Hiral Bhavsar Date: Thu, 8 Jul 2021 13:10:25 +0000 Subject: [PATCH] [FIX] mail: dropzone deactivate for text and user's avatar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: Currently, in Discuss, the chat activates the drop zone when try to drag and drop any user's avatar (or any text). The same thing happens if we do it in the chat window or chatter. After this commit: The chat will not be activated drop zone if the drag is not actually a file/a document. Task-2590510 closes odoo/odoo#80464 X-original-commit: 0e2f46bc2cfd36dc3508a56601239c15e2301571 Signed-off-by: Sébastien Theys (seb) --- .../use_drag_visible_dropzone/use_drag_visible_dropzone.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/component_hooks/use_drag_visible_dropzone/use_drag_visible_dropzone.js b/addons/mail/static/src/component_hooks/use_drag_visible_dropzone/use_drag_visible_dropzone.js index ada2eb3f425..86694083fce 100644 --- a/addons/mail/static/src/component_hooks/use_drag_visible_dropzone/use_drag_visible_dropzone.js +++ b/addons/mail/static/src/component_hooks/use_drag_visible_dropzone/use_drag_visible_dropzone.js @@ -62,7 +62,11 @@ export function useDragVisibleDropZone() { * @param {DragEvent} ev */ function _onDragenterListener(ev) { - if (dragCount === 0) { + if ( + dragCount === 0 && + ev.dataTransfer && + ev.dataTransfer.types.includes('Files') + ) { isVisible.value = true; } dragCount++;