Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RemoveDefault() extension method to fluent API for CMS webhook events #15424

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

ronaldbarendse
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

PR #15345 added a fluent API for adding webhook events, but because the CMS adds a subset of events by default, you had to first clear all events to make sure you only end up with the configured ones. However, if other packages (like Deploy) also add events by default, those will also be cleared.

To address this, I've added a RemoveDefault() extension method, so the following example ensures all CMS default events are removed and only the content ones are added, without affecting other custom/non-CMS events:

using Umbraco.Cms.Core.Composing;

public class WebhookComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
        => builder.WebhookEvents()
            .AddCms(cmsBuilder => cmsBuilder.RemoveDefault().AddContent());
}

@ronaldbarendse
Copy link
Contributor Author

A quick update on this: we've implemented the RemoveDefault() extension method on both Deploy and Forms, so would be nice to have the CMS align on this as well!

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me and agree it would be nice to have this common method across the products.

@bergmania bergmania merged commit 8f26263 into contrib Sep 26, 2024
13 checks passed
@bergmania bergmania deleted the v13/feature/webhooks-removedefault branch September 26, 2024 05:52
bergmania pushed a commit that referenced this pull request Sep 26, 2024
…events (#15424)

* Add RemoveDefault extension method

* Move default webhook event types to single list

(cherry picked from commit 8f26263)
bergmania pushed a commit that referenced this pull request Sep 26, 2024
…events (#15424)

* Add RemoveDefault extension method

* Move default webhook event types to single list

(cherry picked from commit 8f26263)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants