From 73de12037eb4a38238c447799f4cc5608211ebac Mon Sep 17 00:00:00 2001 From: David Greasley Date: Thu, 25 Jun 2015 21:11:36 +0100 Subject: [PATCH] Fixes U4-6579: Checks if media item being deleted was at the root then redirects to the root, otherwise redirects to parent item. --- .../src/views/media/media.delete.controller.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js index eab7bbe4ad..3b25411bf9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js @@ -31,7 +31,13 @@ function MediaDeleteController($scope, mediaResource, treeService, navigationSer //if the current edited item is the same one as we're deleting, we need to navigate elsewhere if (editorState.current && editorState.current.id == $scope.currentNode.id) { - $location.path("/media/media/edit/" + $scope.currentNode.parentId); + + //If the deleted item lived at the root then just redirect back to the root, otherwise redirect to the item's parent + var location = "/media"; + if ($scope.currentNode.parentId != -1) + location = "/media/media/edit/" + $scope.currentNode.parentId; + + $location.path(location); } navigationService.hideMenu();