Added a check for and delete descendants when deleting a dictionary item

This commit is contained in:
Frans de Jong
2019-06-01 13:07:16 +02:00
parent 5f67b3a9c1
commit 457474ecf9

View File

@@ -52,6 +52,13 @@ namespace Umbraco.Web.Editors
if (foundDictionary == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
var foundDictionaryDescendants = Services.LocalizationService.GetDictionaryItemDescendants(foundDictionary.Key);
foreach (var dictionaryItem in foundDictionaryDescendants)
{
Services.LocalizationService.Delete(dictionaryItem, Security.CurrentUser.Id);
}
Services.LocalizationService.Delete(foundDictionary, Security.CurrentUser.Id);
return Request.CreateResponse(HttpStatusCode.OK);