Merge pull request #5558 from FransdeJong/DeleteDictionaryChildren

Added a check for and delete descendants when deleting a dictionary item
This commit is contained in:
Sebastiaan Janssen
2019-06-03 10:21:45 +02:00
committed by GitHub

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);