From d0be4ab263d3996da9ee68456012b6c70c5dba92 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Thu, 9 Nov 2023 13:51:05 +0100 Subject: [PATCH] Publish ContentTreeChangeNotification after saving/deleting blueprints (#14898) --- src/Umbraco.Core/Services/ContentService.cs | 3 +++ .../Cache/DistributedCacheBinder_Handlers.cs | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 262598451a..f324384a3d 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -3568,6 +3568,7 @@ public class ContentService : RepositoryService, IContentService Audit(AuditType.Save, Constants.Security.SuperUserId, content.Id, $"Saved content template: {content.Name}"); scope.Notifications.Publish(new ContentSavedBlueprintNotification(content, evtMsgs)); + scope.Notifications.Publish(new ContentTreeChangeNotification(content, TreeChangeTypes.RefreshNode, evtMsgs)); scope.Complete(); } @@ -3582,6 +3583,7 @@ public class ContentService : RepositoryService, IContentService scope.WriteLock(Constants.Locks.ContentTree); _documentBlueprintRepository.Delete(content); scope.Notifications.Publish(new ContentDeletedBlueprintNotification(content, evtMsgs)); + scope.Notifications.Publish(new ContentTreeChangeNotification(content, TreeChangeTypes.Remove, evtMsgs)); scope.Complete(); } } @@ -3682,6 +3684,7 @@ public class ContentService : RepositoryService, IContentService } scope.Notifications.Publish(new ContentDeletedBlueprintNotification(blueprints, evtMsgs)); + scope.Notifications.Publish(new ContentTreeChangeNotification(blueprints, TreeChangeTypes.Remove, evtMsgs)); scope.Complete(); } } diff --git a/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs index 11119aaf66..0e84c747ac 100644 --- a/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs +++ b/src/Umbraco.Infrastructure/Cache/DistributedCacheBinder_Handlers.cs @@ -67,15 +67,6 @@ public class DistributedCacheBinder : _distributedCache.RefreshContentCache(notification.Changes.ToArray()); } - // private void ContentService_SavedBlueprint(IContentService sender, SaveEventArgs e) - // { - // _distributedCache.RefreshUnpublishedPageCache(e.SavedEntities.ToArray()); - // } - - // private void ContentService_DeletedBlueprint(IContentService sender, DeleteEventArgs e) - // { - // _distributedCache.RemoveUnpublishedPageCache(e.DeletedEntities.ToArray()); - // } #endregion #region LocalizationService / Dictionary