Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/contentcontroller_and_related

This commit is contained in:
Bjarke Berg
2020-06-18 14:43:26 +02:00
7 changed files with 90 additions and 12 deletions

View File

@@ -508,6 +508,16 @@ namespace Umbraco.Core.Services.Implement
// delete content
DeleteItemsOfTypes(descendantsAndSelf.Select(x => x.Id));
// Next find all other document types that have a reference to this content type
var referenceToAllowedContentTypes = GetAll().Where(q => q.AllowedContentTypes.Any(p=>p.Id.Value==item.Id));
foreach (var reference in referenceToAllowedContentTypes)
{
reference.AllowedContentTypes = reference.AllowedContentTypes.Where(p => p.Id.Value != item.Id);
var changedRef = new List<ContentTypeChange<TItem>>() { new ContentTypeChange<TItem>(reference, ContentTypeChangeTypes.RefreshMain) };
// Fire change event
OnChanged(scope, changedRef.ToEventArgs());
}
// finally delete the content type
// - recursively deletes all descendants
@@ -515,7 +525,7 @@ namespace Umbraco.Core.Services.Implement
// (contents of any descendant type have been deleted but
// contents of any composed (impacted) type remain but
// need to have their property data cleared)
Repository.Delete(item);
Repository.Delete(item);
//...
var changes = descendantsAndSelf.Select(x => new ContentTypeChange<TItem>(x, ContentTypeChangeTypes.Remove))