* V15: Fix webhook RTE serialization (#17656)
* Make base type resolver class
* Add new webhook serializer
* fix comment
* Update src/Umbraco.Infrastructure/Serialization/ContentJsonTypeResolverBase.cs
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
* Update src/Umbraco.Core/Services/WebhookRequestService.cs
---------
Co-authored-by: Elitsa <elm@umbraco.dk>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
(cherry picked from commit 6f081785e6)
* Add back missing usings
This commit is contained in:
@@ -26,8 +26,6 @@ using Umbraco.Cms.Core.Notifications;
|
||||
using Umbraco.Cms.Core.Packaging;
|
||||
using Umbraco.Cms.Core.Persistence.Repositories;
|
||||
using Umbraco.Cms.Core.PropertyEditors;
|
||||
using Umbraco.Cms.Core.PublishedCache;
|
||||
using Umbraco.Cms.Core.PublishedCache.Internal;
|
||||
using Umbraco.Cms.Core.Routing;
|
||||
using Umbraco.Cms.Core.Runtime;
|
||||
using Umbraco.Cms.Core.Scoping;
|
||||
@@ -36,7 +34,10 @@ using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Core.Services.ContentTypeEditing;
|
||||
using Umbraco.Cms.Core.DynamicRoot;
|
||||
using Umbraco.Cms.Core.Preview;
|
||||
using Umbraco.Cms.Core.PublishedCache;
|
||||
using Umbraco.Cms.Core.PublishedCache.Internal;
|
||||
using Umbraco.Cms.Core.Security.Authorization;
|
||||
using Umbraco.Cms.Core.Serialization;
|
||||
using Umbraco.Cms.Core.Services.FileSystem;
|
||||
using Umbraco.Cms.Core.Services.ImportExport;
|
||||
using Umbraco.Cms.Core.Services.Querying.RecycleBin;
|
||||
@@ -373,7 +374,10 @@ namespace Umbraco.Cms.Core.DependencyInjection
|
||||
Services.AddUnique<IWebhookService, WebhookService>();
|
||||
Services.AddUnique<IWebhookLogService, WebhookLogService>();
|
||||
Services.AddUnique<IWebhookLogFactory, WebhookLogFactory>();
|
||||
Services.AddUnique<IWebhookRequestService, WebhookRequestService>();
|
||||
Services.AddUnique<IWebhookRequestService>(factory => new WebhookRequestService(
|
||||
factory.GetRequiredService<ICoreScopeProvider>(),
|
||||
factory.GetRequiredService<IWebhookRequestRepository>(),
|
||||
factory.GetRequiredService<IWebhookJsonSerializer>()));
|
||||
|
||||
// Data type configuration cache
|
||||
Services.AddUnique<IDataTypeConfigurationCache, DataTypeConfigurationCache>();
|
||||
|
||||
4
src/Umbraco.Core/Serialization/IWebhookJsonSerializer.cs
Normal file
4
src/Umbraco.Core/Serialization/IWebhookJsonSerializer.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Umbraco.Cms.Core.Serialization;
|
||||
|
||||
public interface IWebhookJsonSerializer : IJsonSerializer
|
||||
{ }
|
||||
@@ -1,4 +1,6 @@
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Persistence.Repositories;
|
||||
using Umbraco.Cms.Core.Scoping;
|
||||
using Umbraco.Cms.Core.Serialization;
|
||||
@@ -9,13 +11,19 @@ public class WebhookRequestService : IWebhookRequestService
|
||||
{
|
||||
private readonly ICoreScopeProvider _coreScopeProvider;
|
||||
private readonly IWebhookRequestRepository _webhookRequestRepository;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IWebhookJsonSerializer _webhookJsonSerializer;
|
||||
|
||||
[Obsolete("This constructor is obsolete and will be removed in future versions. Scheduled for removal in V17")]
|
||||
public WebhookRequestService(ICoreScopeProvider coreScopeProvider, IWebhookRequestRepository webhookRequestRepository, IJsonSerializer jsonSerializer)
|
||||
: this (coreScopeProvider, webhookRequestRepository, StaticServiceProvider.Instance.GetRequiredService<IWebhookJsonSerializer>())
|
||||
{
|
||||
}
|
||||
|
||||
public WebhookRequestService(ICoreScopeProvider coreScopeProvider, IWebhookRequestRepository webhookRequestRepository, IWebhookJsonSerializer webhookJsonSerializer)
|
||||
{
|
||||
_coreScopeProvider = coreScopeProvider;
|
||||
_webhookRequestRepository = webhookRequestRepository;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_webhookJsonSerializer = webhookJsonSerializer;
|
||||
}
|
||||
|
||||
public async Task<WebhookRequest> CreateAsync(Guid webhookKey, string eventAlias, object? payload)
|
||||
@@ -26,7 +34,7 @@ public class WebhookRequestService : IWebhookRequestService
|
||||
{
|
||||
WebhookKey = webhookKey,
|
||||
EventAlias = eventAlias,
|
||||
RequestObject = _jsonSerializer.Serialize(payload),
|
||||
RequestObject = _webhookJsonSerializer.Serialize(payload),
|
||||
RetryCount = 0,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user