From 8e7831f4b85586cdf85bdc3294c8a1cad8af77e3 Mon Sep 17 00:00:00 2001 From: Jeffrey Schoemaker Date: Tue, 31 Oct 2023 12:17:34 +0100 Subject: [PATCH 1/3] Update NestedContentPropertyEditor.cs - Update obsolete message (#14953) Nested Content is removed in v14, not in v13 anymore. This makes sure developers won't get confused / in panic mode --- .../PropertyEditors/NestedContentPropertyEditor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs index bf5781079a..1bfa3a7ed0 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs @@ -28,7 +28,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; Icon = "icon-thumbnail-list", ValueEditorIsReusable = false, IsDeprecated = true)] -[Obsolete("Nested content is obsolete, will be removed in V13")] +[Obsolete("Nested content is obsolete, will be removed in Umbraco 14")] public class NestedContentPropertyEditor : DataEditor { public const string ContentTypeAliasPropertyKey = "ncContentTypeAlias"; @@ -36,7 +36,7 @@ public class NestedContentPropertyEditor : DataEditor private readonly IIOHelper _ioHelper; private readonly INestedContentPropertyIndexValueFactory _nestedContentPropertyIndexValueFactory; - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 12.")] + [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 14.")] public NestedContentPropertyEditor( IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper) @@ -44,7 +44,7 @@ public class NestedContentPropertyEditor : DataEditor { } - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 13.")] + [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 14.")] public NestedContentPropertyEditor( IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper, From 767770891723d483c84b6f8d6de01b0adaca1245 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Tue, 31 Oct 2023 12:18:51 +0100 Subject: [PATCH 2/3] Fix `JsonNetSerializer` settings leaking into derived implementations (#14814) * Change settings static field to instance property * Rename property to Settings --- .../ConfigurationEditorJsonSerializer.cs | 6 ++---- .../Serialization/JsonNetSerializer.cs | 11 ++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Infrastructure/Serialization/ConfigurationEditorJsonSerializer.cs b/src/Umbraco.Infrastructure/Serialization/ConfigurationEditorJsonSerializer.cs index 82f6e01475..8c94cb53c1 100644 --- a/src/Umbraco.Infrastructure/Serialization/ConfigurationEditorJsonSerializer.cs +++ b/src/Umbraco.Infrastructure/Serialization/ConfigurationEditorJsonSerializer.cs @@ -10,10 +10,8 @@ public class ConfigurationEditorJsonSerializer : JsonNetSerializer, IConfigurati { public ConfigurationEditorJsonSerializer() { - JsonSerializerSettings.Converters.Add(new FuzzyBooleanConverter()); - JsonSerializerSettings.ContractResolver = new ConfigurationCustomContractResolver(); - JsonSerializerSettings.Formatting = Formatting.None; - JsonSerializerSettings.NullValueHandling = NullValueHandling.Ignore; + Settings.Converters.Add(new FuzzyBooleanConverter()); + Settings.ContractResolver = new ConfigurationCustomContractResolver(); } private class ConfigurationCustomContractResolver : DefaultContractResolver diff --git a/src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs b/src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs index dfab4ba5e4..8057ba6168 100644 --- a/src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs +++ b/src/Umbraco.Infrastructure/Serialization/JsonNetSerializer.cs @@ -7,23 +7,20 @@ namespace Umbraco.Cms.Infrastructure.Serialization; public class JsonNetSerializer : IJsonSerializer { - protected static readonly JsonSerializerSettings JsonSerializerSettings = new() + protected JsonSerializerSettings Settings { get; } = new() { Converters = new List { new StringEnumConverter() }, Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore, }; - public string Serialize(object? input) => JsonConvert.SerializeObject(input, JsonSerializerSettings); + public string Serialize(object? input) => JsonConvert.SerializeObject(input, Settings); - public T? Deserialize(string input) => JsonConvert.DeserializeObject(input, JsonSerializerSettings); + public T? Deserialize(string input) => JsonConvert.DeserializeObject(input, Settings); public T? DeserializeSubset(string input, string key) { - if (key == null) - { - throw new ArgumentNullException(nameof(key)); - } + ArgumentNullException.ThrowIfNull(key); JObject? root = Deserialize(input); JToken? jToken = root?.SelectToken(key); From eb355f4ab68a165d1df7f3d0f7e98245aa024b73 Mon Sep 17 00:00:00 2001 From: Zeegaan Date: Tue, 31 Oct 2023 12:30:12 +0100 Subject: [PATCH 3/3] Compare invariant to string instead, as SqlServer rounds DateTime --- .../Umbraco.Core/Services/WebhookLogServiceTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/WebhookLogServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/WebhookLogServiceTests.cs index 7716f83eda..af75becd1c 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/WebhookLogServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/WebhookLogServiceTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using System.Globalization; +using NUnit.Framework; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Services; @@ -37,7 +38,7 @@ public class WebhookLogServiceTests : UmbracoIntegrationTest Assert.IsNotEmpty(webhookLogsPaged.Items); Assert.AreEqual(1, webhookLogsPaged.Items.Count()); var webHookLog = webhookLogsPaged.Items.First(); - Assert.AreEqual(createdWebhookLog.Date, webHookLog.Date); + Assert.AreEqual(createdWebhookLog.Date.ToString(CultureInfo.InvariantCulture), webHookLog.Date.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(createdWebhookLog.EventName, webHookLog.EventName); Assert.AreEqual(createdWebhookLog.RequestBody, webHookLog.RequestBody); Assert.AreEqual(createdWebhookLog.ResponseBody, webHookLog.ResponseBody);