From e8cb0cccbc868198399082d6bc17531e72ba9b66 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Mon, 23 Oct 2023 11:24:52 +0100 Subject: [PATCH] Avoid sending move requests for files in moved folders (#15313) GitOrigin-RevId: 87244b785eeeb2dadb0b4b06c9725a1ddee0562f --- .../features/file-tree/contexts/file-tree-actionable.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.jsx b/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.jsx index 06b03a12d2..fff9b09d71 100644 --- a/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.jsx +++ b/services/web/frontend/js/features/file-tree/contexts/file-tree-actionable.jsx @@ -219,12 +219,16 @@ export function FileTreeActionableProvider({ reindexReferences, children }) { (toFolderId, draggedEntityIds) => { dispatch({ type: ACTION_TYPES.MOVING }) - // find entities and filter out no-ops + // find entities and filter out no-ops and nested files const founds = Array.from(draggedEntityIds) .map(draggedEntityId => findInTreeOrThrow(fileTreeData, draggedEntityId) ) - .filter(found => found.parentFolderId !== toFolderId) + .filter( + found => + found.parentFolderId !== toFolderId && + !draggedEntityIds.has(found.parentFolderId) + ) // make sure all entities can be moved, return early otherwise const isMoveToRoot = toFolderId === fileTreeData._id