Fixed test by moving when the publishing notification is fired.

This commit is contained in:
Bjarke Berg
2024-06-25 10:03:19 +02:00
parent bda23c35e3
commit 9ad67e27c5

View File

@@ -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<CultureImpact?> 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;