Skip move logic if the parent is staying the same (#12937)

* v10/feature/skip-move-logic: add logic to skip move logic when parentId would be the same as before

* v10/feature/skip-move-logic: remove unnecessary checks

* remove check for mediaservice as there is already one in place

* remove unnecessary using

* added parent checks for dictionary items

* changing behaviour for contenttypes, datatypes and mediatypes to show errors on move
This commit is contained in:
CyberReiter
2022-09-09 03:06:50 +02:00
committed by GitHub
parent 1bd0a1f86d
commit 4df012e8e9
8 changed files with 28 additions and 8 deletions

View File

@@ -260,6 +260,11 @@ public class DictionaryController : BackOfficeNotificationsController
return ValidationProblem(_localizedTextService.Localize("dictionary", "itemDoesNotExists"));
}
if(dictionaryItem.ParentId == null && move.ParentId == Constants.System.Root)
{
return ValidationProblem(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
}
IDictionaryItem? parent = _localizationService.GetDictionaryItemById(move.ParentId);
if (parent == null)
{
@@ -274,6 +279,11 @@ public class DictionaryController : BackOfficeNotificationsController
}
else
{
if (dictionaryItem.ParentId == parent.Key)
{
return ValidationProblem(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
}
dictionaryItem.ParentId = parent.Key;
if (dictionaryItem.Key == parent.ParentId)
{