From 457474ecf9048a7a5e5c8a3a1466e6fc447899dd Mon Sep 17 00:00:00 2001 From: Frans de Jong Date: Sat, 1 Jun 2019 13:07:16 +0200 Subject: [PATCH] Added a check for and delete descendants when deleting a dictionary item --- src/Umbraco.Web/Editors/DictionaryController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs index 120ebeded7..d132fdc201 100644 --- a/src/Umbraco.Web/Editors/DictionaryController.cs +++ b/src/Umbraco.Web/Editors/DictionaryController.cs @@ -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);