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

V13: Webhook all the things #15161

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a7c4a8f
Adds Language WebHooks & Moves existing Core ones into own folder/nam…
warrenbuckley Nov 7, 2023
cd12abc
Updates WebHook Collection to have handy Extension method for AddLang…
warrenbuckley Nov 7, 2023
90d5548
Adds Dictionary WebHooks
warrenbuckley Nov 7, 2023
41bff00
Adds domain webhooks
warrenbuckley Nov 7, 2023
f462aba
Formatting - CTRL K + CTRL D
warrenbuckley Nov 7, 2023
7a5b166
Adds DataType Webhooks
warrenbuckley Nov 7, 2023
f20244e
Adds Relations and Relation Types to Webhook Events
warrenbuckley Nov 7, 2023
70d4e18
Adds stylesheet webhooks
warrenbuckley Nov 7, 2023
2e865f8
Adds Template/Partial View Webhooks
warrenbuckley Nov 7, 2023
df1e2ed
Adds script webhooks
warrenbuckley Nov 7, 2023
6397b18
Namespace change as there are more media and content events/notificat…
warrenbuckley Nov 7, 2023
98c255a
Adds Package Webhook
warrenbuckley Nov 7, 2023
5ea95fb
Adds Media WebHooks
warrenbuckley Nov 7, 2023
819c108
Adds more Media Webhooks
warrenbuckley Nov 7, 2023
cfec660
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 9, 2023
642bad8
WIP: Updates to changes made in dev branch
warrenbuckley Nov 9, 2023
a6e668a
Update existing Webhooks to use the new attribute
warrenbuckley Nov 10, 2023
b229c8d
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 10, 2023
5187649
After merge - fixes the change from IWebHookService to IWebhookService
warrenbuckley Nov 10, 2023
389525f
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 13, 2023
0ac1595
Rename to align with the name of underlying Notification
warrenbuckley Nov 13, 2023
a4c0f7c
Adds a couple more Webhook events - Content Saved, Rolled Back and Em…
warrenbuckley Nov 13, 2023
8abdbc0
For now empty recylce bin returns the IContent entity as the previous…
warrenbuckley Nov 13, 2023
b6465be
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 13, 2023
081178d
Adds Member Type notifications
warrenbuckley Nov 13, 2023
021169d
Adds more Content based Webhooks
warrenbuckley Nov 14, 2023
604c9e7
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 14, 2023
b938020
Merge tag 'release-13.0.0-rc2' into v13/feature/webhook-all-the-things
warrenbuckley Nov 15, 2023
5939f42
Adds the last of the Content related notifications as Webhooks that I…
warrenbuckley Nov 15, 2023
00f44d5
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 17, 2023
c6a9a61
Adds PublicAccess WebHooks
warrenbuckley Nov 19, 2023
05647ad
Merge remote-tracking branch 'upstream/release/13.0' into v13/feature…
warrenbuckley Nov 19, 2023
2c88377
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 21, 2023
fba16cd
Fix up misaligned namespaces - too much copy/pasting
warrenbuckley Nov 21, 2023
80bdd89
Adds Member Webhook for Saved & Deleted
warrenbuckley Nov 21, 2023
b0c75f9
Merge branch 'v13/feature/webhook-all-the-things' of https://github.c…
warrenbuckley Nov 21, 2023
cc3d45b
WebHookEventBase ConvertNotificationToRequestPayload that could be ov…
warrenbuckley Nov 21, 2023
5561f8c
Adds the last fo the member webhooks
warrenbuckley Nov 21, 2023
c3fb6ef
Adds AllTheWebHook to the collection builder to easily see all events…
warrenbuckley Nov 21, 2023
362d36f
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 21, 2023
5c6eb4a
Adds the User related Webhooks
warrenbuckley Nov 21, 2023
b74ecd6
Refined the template webhooks mostly to remove Messages & State prope…
warrenbuckley Nov 22, 2023
69bc1aa
Refined the stylesheet webhooks mostly to remove Messages & State pro…
warrenbuckley Nov 22, 2023
065e406
Refined the script webhooks mostly to remove Messages & State properties
warrenbuckley Nov 22, 2023
ab7b40b
Refined the Relation and RelationType webhooks mostly to remove Messa…
warrenbuckley Nov 22, 2023
08f4ae1
Refined the PublicAccess webhooks mostly to remove Messages & State p…
warrenbuckley Nov 22, 2023
c9619bc
Refined the MemberType webhooks mostly to remove Messages & State pro…
warrenbuckley Nov 22, 2023
b68d3b6
Refined the Member webhooks mostly to remove Messages & State properties
warrenbuckley Nov 22, 2023
4da31ce
Refined the Media webhooks mostly to remove Messages & State properties
warrenbuckley Nov 22, 2023
88179ff
Refined the Language webhooks mostly to remove Messages & State prope…
warrenbuckley Nov 22, 2023
05ccfd6
Refined the Domain webhooks mostly to remove Messages & State properties
warrenbuckley Nov 22, 2023
8e0d8f3
Refined the Dictionary webhooks mostly to remove Messages & State pro…
warrenbuckley Nov 22, 2023
29dc36d
Refined the DataType webhooks mostly to remove Messages & State prope…
warrenbuckley Nov 22, 2023
3897c56
Refined the Content webhooks mostly to remove Messages & State proper…
warrenbuckley Nov 22, 2023
80c3806
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 22, 2023
80526ae
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 23, 2023
25f40f1
Merge remote-tracking branch 'upstream/release/13.0' into v13/feature…
warrenbuckley Nov 27, 2023
bf751d4
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 28, 2023
58aa1d8
Updates the infinite editor for the WebHook events to be sorted by th…
warrenbuckley Nov 28, 2023
c66f9c3
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 28, 2023
8e5b9b4
Infinite Editor for Webhook Events with filtering like icon picker
warrenbuckley Nov 28, 2023
43ca562
Add a language key webhooks_noEventsFound
warrenbuckley Nov 28, 2023
ccc7409
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
warrenbuckley Nov 28, 2023
1bffdc4
Merge branch 'v13/feature/webhook-all-the-things' of https://github.c…
warrenbuckley Nov 30, 2023
c32d2be
Spell MediaType without space, consistent with the other Types
nul800sebastiaan Nov 30, 2023
f4399ed
Clarify method name
nul800sebastiaan Nov 30, 2023
dadf2c7
Spell RelationType without space, consistent with the other Types
nul800sebastiaan Nov 30, 2023
cd626b1
Correct wrong names
nul800sebastiaan Nov 30, 2023
34e381f
Consistency in folders and naming (everything WITH a space - changed …
nul800sebastiaan Nov 30, 2023
6db15aa
More consistency
nul800sebastiaan Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/Umbraco.Core/Constants-WebhookEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,57 @@ public static class WebhookEvents
{
public static class Aliases
{

/// <summary>
/// Webhook event alias for content versions deleted
/// </summary>
public const string ContentDeletedVersions = "Umbraco.ContentDeletedVersions";

/// <summary>
/// Webhook event alias for content blueprint saved
/// </summary>
public const string ContentSavedBlueprint = "Umbraco.ContentSavedBlueprint";

/// <summary>
/// Webhook event alias for content blueprint deleted
/// </summary>
public const string ContentDeletedBlueprint = "Umbraco.ContentDeletedBlueprint";

/// <summary>
/// Webhook event alias for content moved into the recycle bin.
/// </summary>
public const string ContentMovedToRecycleBin = "Umbraco.ContentMovedToRecycleBin";

/// <summary>
/// Webhook event alias for content sorted.
/// </summary>
public const string ContentSorted = "Umbraco.ContentSorted";

/// <summary>
/// Webhook event alias for content moved.
/// </summary>
public const string ContentMoved = "Umbraco.ContentMoved";

/// <summary>
/// Webhook event alias for content copied.
/// </summary>
public const string ContentCopied = "Umbraco.ContentCopied";

/// <summary>
/// Webhook event alias for content emptied recycle bin.
/// </summary>
public const string ContentEmptiedRecycleBin = "Umbraco.ContentEmptiedRecycleBin";

/// <summary>
/// Webhook event alias for content rolled back.
/// </summary>
public const string ContentRolledBack = "Umbraco.ContentRolledBack";

/// <summary>
/// Webhook event alias for content saved.
/// </summary>
public const string ContentSaved = "Umbraco.ContentSaved";

/// <summary>
/// Webhook event alias for content publish.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Umbraco.Core/EmbeddedResources/Lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="createHeader">Create header</key>
<key alias="logs">Logs</key>
<key alias="noHeaders">No webhook headers have been added</key>
<key alias="noEventsFound">No events were found.</key>
</area>
<area alias="languages">
<key alias="addLanguage">Add language</key>
Expand Down
1 change: 1 addition & 0 deletions src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="createHeader">Create header</key>
<key alias="logs">Logs</key>
<key alias="noHeaders">No webhook headers have been added</key>
<key alias="noEventsFound">No events were found.</key>
</area>
<area alias="languages">
<key alias="addLanguage">Add language</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Copied", Constants.WebhookEvents.Types.Content)]
public class ContentCopiedWebhookEvent : WebhookEventBase<ContentCopiedNotification>
{
public ContentCopiedWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}

public override string Alias => Constants.WebhookEvents.Aliases.ContentCopied;

public override object? ConvertNotificationToRequestPayload(ContentCopiedNotification notification)
{
return new
{
notification.Copy,
notification.Original,
notification.ParentId,
notification.RelateToOriginal
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Template [Blueprint] Deleted", Constants.WebhookEvents.Types.Content)]
public class ContentDeletedBlueprintWebhookEvent : WebhookEventContentBase<ContentDeletedBlueprintNotification, IContent>
{
public ContentDeletedBlueprintWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}

public override string Alias => Constants.WebhookEvents.Aliases.ContentDeletedBlueprint;

protected override IEnumerable<IContent> GetEntitiesFromNotification(ContentDeletedBlueprintNotification notification) =>
notification.DeletedBlueprints;

protected override object ConvertEntityToRequestPayload(IContent entity) => entity;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Versions Deleted", Constants.WebhookEvents.Types.Content)]
public class ContentDeletedVersionsWebhookEvent : WebhookEventBase<ContentDeletedVersionsNotification>
{
public ContentDeletedVersionsWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}

public override string Alias => Constants.WebhookEvents.Aliases.ContentDeletedVersions;

public override object? ConvertNotificationToRequestPayload(ContentDeletedVersionsNotification notification)
{
return new
{
notification.Id,
notification.DeletePriorVersions,
notification.SpecificVersion,
notification.DateToRetain
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events;
namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content was deleted", Constants.WebhookEvents.Types.Content)]
public class ContentDeleteWebhookEvent : WebhookEventContentBase<ContentDeletedNotification, IContent>
[WebhookEvent("Content Deleted", Constants.WebhookEvents.Types.Content)]
public class ContentDeletedWebhookEvent : WebhookEventContentBase<ContentDeletedNotification, IContent>
{
public ContentDeleteWebhookEvent(
public ContentDeletedWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Recycle Bin Emptied", Constants.WebhookEvents.Types.Content)]
public class ContentEmptiedRecycleBinWebhookEvent : WebhookEventContentBase<ContentEmptiedRecycleBinNotification, IContent>
{
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IApiContentBuilder _apiContentBuilder;

public ContentEmptiedRecycleBinWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IApiContentBuilder apiContentBuilder)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
_publishedSnapshotAccessor = publishedSnapshotAccessor;
_apiContentBuilder = apiContentBuilder;
}

Check warning on line 33 in src/Umbraco.Core/Webhooks/Events/Content/ContentEmptiedRecycleBinWebhookEvent.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

❌ New issue: Constructor Over-Injection

ContentEmptiedRecycleBinWebhookEvent has 6 arguments, threshold = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.

public override string Alias => Constants.WebhookEvents.Aliases.ContentEmptiedRecycleBin;

protected override IEnumerable<IContent> GetEntitiesFromNotification(ContentEmptiedRecycleBinNotification notification) =>
notification.DeletedEntities;

protected override object? ConvertEntityToRequestPayload(IContent entity) => entity;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Moved to Recycle Bin", Constants.WebhookEvents.Types.Content)]
public class ContentMovedToRecycleBinWebhookEvent : WebhookEventBase<ContentMovedToRecycleBinNotification>
{
public ContentMovedToRecycleBinWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}

public override string Alias => Constants.WebhookEvents.Aliases.ContentMovedToRecycleBin;

public override object? ConvertNotificationToRequestPayload(ContentMovedToRecycleBinNotification notification)
=> notification.MoveInfoCollection;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Moved", Constants.WebhookEvents.Types.Content)]
public class ContentMovedWebhookEvent : WebhookEventBase<ContentMovedNotification>
{
public ContentMovedWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}

public override string Alias => Constants.WebhookEvents.Aliases.ContentMoved;

public override object? ConvertNotificationToRequestPayload(ContentMovedNotification notification)
=> notification.MoveInfoCollection;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events;
namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content was published", Constants.WebhookEvents.Types.Content)]
public class ContentPublishWebhookEvent : WebhookEventContentBase<ContentPublishedNotification, IContent>
[WebhookEvent("Content Published", Constants.WebhookEvents.Types.Content)]
public class ContentPublishedWebhookEvent : WebhookEventContentBase<ContentPublishedNotification, IContent>
{
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IApiContentBuilder _apiContentBuilder;

public ContentPublishWebhookEvent(
public ContentPublishedWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IApiContentBuilder apiContentBuilder)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
_publishedSnapshotAccessor = publishedSnapshotAccessor;
_apiContentBuilder = apiContentBuilder;
}

Check warning on line 34 in src/Umbraco.Core/Webhooks/Events/Content/ContentPublishedWebhookEvent.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

❌ New issue: Constructor Over-Injection

ContentPublishedWebhookEvent has 6 arguments, threshold = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.

public override string Alias => Constants.WebhookEvents.Aliases.ContentPublish;

Expand Down
52 changes: 52 additions & 0 deletions src/Umbraco.Core/Webhooks/Events/Content/ContentRolledBack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;

namespace Umbraco.Cms.Core.Webhooks.Events.Content;

[WebhookEvent("Content Rolled Back", Constants.WebhookEvents.Types.Content)]
public class ContentRolledBackWebhookEvent : WebhookEventContentBase<ContentRolledBackNotification, IContent>
{
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IApiContentBuilder _apiContentBuilder;

public ContentRolledBackWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IApiContentBuilder apiContentBuilder)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
_publishedSnapshotAccessor = publishedSnapshotAccessor;
_apiContentBuilder = apiContentBuilder;
}

Check warning on line 34 in src/Umbraco.Core/Webhooks/Events/Content/ContentRolledBack.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

❌ New issue: Constructor Over-Injection

ContentRolledBackWebhookEvent has 6 arguments, threshold = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.

public override string Alias => Constants.WebhookEvents.Aliases.ContentRolledBack;

protected override IEnumerable<IContent> GetEntitiesFromNotification(ContentRolledBackNotification notification) =>
new List<IContent> { notification.Entity };

protected override object? ConvertEntityToRequestPayload(IContent entity)
{
if (_publishedSnapshotAccessor.TryGetPublishedSnapshot(out IPublishedSnapshot? publishedSnapshot) is false || publishedSnapshot!.Content is null)
{
return null;
}

// Get preview/saved version of content for a rollback
IPublishedContent? publishedContent = publishedSnapshot.Content.GetById(true, entity.Key);
return publishedContent is null ? null : _apiContentBuilder.Build(publishedContent);
}
}
Loading
Loading