Merge pull request #2525 from overleaf/cmg-duplicate-modal-updates

Stop duplicate file modal appearing when moving back to original folder

GitOrigin-RevId: 4b8cd83df1bb3ce854e4f7e46176f9171bd61aa0
This commit is contained in:
Simon Detheridge 2020-01-16 14:54:13 +00:00 committed by Copybot
parent db27215760
commit 3157d0e04d

View file

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