From 9ad67e27c5f2b9ebf181f02dc90df1b18e85541a Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 25 Jun 2024 10:03:19 +0200 Subject: [PATCH] Fixed test by moving when the publishing notification is fired. --- src/Umbraco.Core/Services/ContentService.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index fb98a8ff88..dd61585203 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -1188,14 +1188,6 @@ public class ContentService : RepositoryService, IContentService var allLangs = _languageRepository.GetMany().ToList(); - // Change state to publishing - content.PublishedState = PublishedState.Publishing; - var publishingNotification = new ContentPublishingNotification(content, evtMsgs); - if (scope.Notifications.PublishCancelable(publishingNotification)) - { - return new PublishResult(PublishResultType.FailedPublishCancelledByEvent, evtMsgs, content); - } - // this will create the correct culture impact even if culture is * or null IEnumerable impacts = cultures.Select(culture => _cultureImpactFactory.Create(culture, IsDefaultCulture(allLangs, culture), content)); @@ -1207,6 +1199,14 @@ public class ContentService : RepositoryService, IContentService content.PublishCulture(impact); } + // Change state to publishing + content.PublishedState = PublishedState.Publishing; + var publishingNotification = new ContentPublishingNotification(content, evtMsgs); + if (scope.Notifications.PublishCancelable(publishingNotification)) + { + return new PublishResult(PublishResultType.FailedPublishCancelledByEvent, evtMsgs, content); + } + PublishResult result = CommitDocumentChangesInternal(scope, content, evtMsgs, allLangs, publishingNotification.State, userId); scope.Complete(); return result;