Merge pull request #2604 from overleaf/cmg-duplicate-modal-root

Stop duplicate file modal appearing when moving back to original folder - root edition

GitOrigin-RevId: 11fe3b2457190f8bada010a344143a66b8967f34
This commit is contained in:
Simon Detheridge 2020-02-18 11:37:02 +00:00 committed by Copybot
parent b812109cb7
commit bb3394885c

View file

@ -22,19 +22,24 @@ define(['base'], App =>
} else { } else {
entities = [$(ui.draggable).scope().entity] entities = [$(ui.draggable).scope().entity]
} }
const ids = rootFolder.children.map(entity => entity.id)
for (let dropped_entity of Array.from(entities)) { for (let dropped_entity of Array.from(entities)) {
try { if (!ids.includes(dropped_entity.id)) {
ide.fileTreeManager.moveEntity(dropped_entity, rootFolder) try {
} catch (err) { ide.fileTreeManager.moveEntity(dropped_entity, rootFolder)
$modal.open({ } catch (err) {
templateUrl: 'duplicateFileModalTemplate', $modal.open({
controller: 'DuplicateFileModalController', templateUrl: 'duplicateFileModalTemplate',
resolve: { controller: 'DuplicateFileModalController',
fileName() { resolve: {
return dropped_entity.name fileName() {
return dropped_entity.name
}
} }
} })
}) }
} }
} }
$scope.$digest() $scope.$digest()