From 6a8fc09acdf068f97ff223d76200fa12711426d8 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 15 Nov 2018 14:58:10 +0100 Subject: [PATCH] Fix ContentService branch publishing events --- src/Umbraco.Core/Services/Implement/ContentService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 3d207a726d..6c3ade2964 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -1109,9 +1109,11 @@ namespace Umbraco.Core.Services.Implement changeType = TreeChangeTypes.RefreshBranch; // whole branch // invalidate the node/branch - if (!branchOne || branchRoot) + if (!branchOne) // for branches, handled by SaveAndPublishBranch + { scope.Events.Dispatch(TreeChanged, this, new TreeChange(content, changeType).ToEventArgs()); - scope.Events.Dispatch(Published, this, new PublishEventArgs(content, false, false), "Published"); + scope.Events.Dispatch(Published, this, new PublishEventArgs(content, false, false), "Published"); + } // if was not published and now is... descendants that were 'published' (but // had an unpublished ancestor) are 're-published' ie not explicitely published @@ -1456,6 +1458,10 @@ namespace Umbraco.Core.Services.Implement Audit(AuditType.Publish, userId, document.Id, "Branch published"); + // trigger events for the entire branch + scope.Events.Dispatch(TreeChanged, this, new TreeChange(document, TreeChangeTypes.RefreshBranch).ToEventArgs()); + scope.Events.Dispatch(Published, this, new PublishEventArgs(publishedDocuments, false, false), "Published"); + scope.Complete(); }