Merge remote-tracking branch 'origin/release/14.3' into v14/dev

This commit is contained in:
Bjarke Berg
2024-09-26 08:54:19 +02:00

View File

@@ -9,6 +9,15 @@ namespace Umbraco.Cms.Core.DependencyInjection;
/// </summary>
public static class WebhookEventCollectionBuilderCmsExtensions
{
private static readonly Type[] _defaultTypes =
[
typeof(ContentDeletedWebhookEvent),
typeof(ContentPublishedWebhookEvent),
typeof(ContentUnpublishedWebhookEvent),
typeof(MediaDeletedWebhookEvent),
typeof(MediaSavedWebhookEvent),
];
/// <summary>
/// Adds the default webhook events.
/// </summary>
@@ -21,12 +30,24 @@ public static class WebhookEventCollectionBuilderCmsExtensions
/// </remarks>
public static WebhookEventCollectionBuilderCms AddDefault(this WebhookEventCollectionBuilderCms builder)
{
builder.Builder
.Add<ContentDeletedWebhookEvent>()
.Add<ContentPublishedWebhookEvent>()
.Add<ContentUnpublishedWebhookEvent>()
.Add<MediaDeletedWebhookEvent>()
.Add<MediaSavedWebhookEvent>();
builder.Builder.Add(_defaultTypes);
return builder;
}
/// <summary>
/// Removes the default webhook events.
/// </summary>
/// <param name="builder">The builder.</param>
/// <returns>
/// The builder.
/// </returns>
public static WebhookEventCollectionBuilderCms RemoveDefault(this WebhookEventCollectionBuilderCms builder)
{
foreach (Type type in _defaultTypes)
{
builder.Builder.Remove(type);
}
return builder;
}