From 9bafdbd992534c14d8ee8fad53c700258c15b3f3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Biel Date: Wed, 31 May 2023 16:33:23 +0100 Subject: [PATCH] Add notification flag to indicate the current publish operation includes descendants (#13145) --- .../Notifications/ContentPublishedNotification.cs | 7 +++++-- src/Umbraco.Core/Services/ContentService.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Notifications/ContentPublishedNotification.cs b/src/Umbraco.Core/Notifications/ContentPublishedNotification.cs index a5929a393f..7c82561785 100644 --- a/src/Umbraco.Core/Notifications/ContentPublishedNotification.cs +++ b/src/Umbraco.Core/Notifications/ContentPublishedNotification.cs @@ -21,8 +21,11 @@ public sealed class ContentPublishedNotification : EnumerableObjectNotification< { } - /// - /// Gets a enumeration of with the published entities. + public ContentPublishedNotification(IEnumerable target, EventMessages messages, bool includeDescendants) + : base(target, messages) => IncludeDescendants = includeDescendants; + /// public IEnumerable PublishedEntities => Target; + + public bool IncludeDescendants { get; set; } } diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index c32a1a4183..c67b959826 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -2164,7 +2164,7 @@ public class ContentService : RepositoryService, IContentService // (SaveAndPublishBranchOne does *not* do it) scope.Notifications.Publish( new ContentTreeChangeNotification(document, TreeChangeTypes.RefreshBranch, eventMessages)); - scope.Notifications.Publish(new ContentPublishedNotification(publishedDocuments, eventMessages)); + scope.Notifications.Publish(new ContentPublishedNotification(publishedDocuments, eventMessages, true)); scope.Complete(); }