diff --git a/Directory.Packages.props b/Directory.Packages.props index b06a6b7df2..604fd0c35b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -41,8 +41,8 @@ - - + + @@ -90,4 +90,4 @@ - + \ No newline at end of file diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index e5e85eb22e..45dd3288c4 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -18582,8 +18582,7 @@ "ContentVersionPreventCleanup", "ContentVersionEnableCleanup" ], - "type": "integer", - "format": "int32" + "type": "string" }, "ChangePasswordUserRequestModel": { "type": "object", @@ -18651,8 +18650,7 @@ "Published", "PublishedPendingChanges" ], - "type": "integer", - "format": "int32" + "type": "string" }, "ContentTreeItemResponseModel": { "type": "object", @@ -18712,8 +18710,7 @@ "Composition", "Inheritance" ], - "type": "integer", - "format": "int32" + "type": "string" }, "ContentTypeForDocumentTypeResponseModel": { "type": "object", @@ -19872,8 +19869,7 @@ "Ascending", "Descending" ], - "type": "integer", - "format": "int32" + "type": "string" }, "DisableUserRequestModel": { "type": "object", @@ -20501,8 +20497,7 @@ "Unhealthy", "Rebuilding" ], - "type": "integer", - "format": "int32" + "type": "string" }, "HelpPageResponseModel": { "type": "object", @@ -20809,8 +20804,7 @@ "Error", "Fatal" ], - "type": "integer", - "format": "int32" + "type": "string" }, "LogMessagePropertyPresentationModel": { "type": "object", @@ -21077,8 +21071,7 @@ "SourceCodeManual", "SourceCodeAuto" ], - "type": "integer", - "format": "int32" + "type": "string" }, "MoveDataTypeRequestModel": { "type": "object", @@ -21159,8 +21152,7 @@ "GreaterThan", "GreaterThanEqualTo" ], - "type": "integer", - "format": "int32" + "type": "string" }, "OutOfDateStatusResponseModel": { "type": "object", @@ -21177,8 +21169,7 @@ "Current", "Unknown" ], - "type": "integer", - "format": "int32" + "type": "string" }, "PackageDefinitionResponseModel": { "type": "object", @@ -22541,8 +22532,7 @@ "Publishing", "Unpublishing" ], - "type": "integer", - "format": "int32" + "type": "string" }, "RecycleBinItemResponseModel": { "type": "object", @@ -22579,8 +22569,7 @@ "Enabled", "Disabled" ], - "type": "integer", - "format": "int32" + "type": "string" }, "RedirectUrlResponseModel": { "type": "object", @@ -22840,8 +22829,7 @@ "Run", "BootFailed" ], - "type": "integer", - "format": "int32" + "type": "string" }, "SavedLogSearchPresenationBaseModel": { "type": "object", @@ -23048,8 +23036,7 @@ "Error", "Info" ], - "type": "integer", - "format": "int32" + "type": "string" }, "StylesheetItemResponseModel": { "type": "object", @@ -23118,8 +23105,7 @@ "Basic", "Detailed" ], - "type": "integer", - "format": "int32" + "type": "string" }, "TelemetryRepresentationBaseModel": { "type": "object", @@ -23277,8 +23263,7 @@ "DateTime", "Integer" ], - "type": "integer", - "format": "int32" + "type": "string" }, "TemplateQueryResultItemPresentationModel": { "type": "object", @@ -24135,8 +24120,7 @@ "IsLockedOut", "LastLoginDate" ], - "type": "integer", - "format": "int32" + "type": "string" }, "UserPermissionModel": { "type": "object", @@ -24297,8 +24281,7 @@ "Inactive", "All" ], - "type": "integer", - "format": "int32" + "type": "string" }, "UserTourStatusesResponseModel": { "type": "object", diff --git a/src/Umbraco.Cms.Api.Management/Services/JsonPatchService.cs b/src/Umbraco.Cms.Api.Management/Services/JsonPatchService.cs index 850e4a2a17..74f3af50c9 100644 --- a/src/Umbraco.Cms.Api.Management/Services/JsonPatchService.cs +++ b/src/Umbraco.Cms.Api.Management/Services/JsonPatchService.cs @@ -1,4 +1,6 @@ -using System.Text.Json.Nodes; +using System.Text; +using System.Text.Json; +using System.Text.Json.Nodes; using Json.Patch; using Umbraco.Cms.Api.Management.Serialization; using Umbraco.Cms.Api.Management.ViewModels.JsonPatch; @@ -18,7 +20,8 @@ public class JsonPatchService : IJsonPatchService var docString = _jsonSerializer.Serialize(objectToPatch); JsonPatch? patch = _jsonSerializer.Deserialize(patchString); - var doc = JsonNode.Parse(docString); - return patch?.Apply(doc); + var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(docString)); + var element = JsonElement.ParseValue(ref reader); + return patch?.Apply(element); } } diff --git a/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj b/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj index 37aa74414c..1bd90ae690 100644 --- a/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj +++ b/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj @@ -21,4 +21,8 @@ + + + + diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyEditor.cs index acfe6659c5..59ff074bd3 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyEditor.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using Microsoft.Extensions.DependencyInjection; +using Umbraco.Cms.Core.Serialization; using Umbraco.Cms.Web.Common.DependencyInjection; namespace Umbraco.Cms.Core.PropertyEditors; @@ -14,14 +15,12 @@ public abstract class BlockEditorPropertyEditor : BlockListPropertyEditorBase public const string ContentTypeKeyPropertyKey = "contentTypeKey"; public const string UdiPropertyKey = "udi"; - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 13.")] + [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 15.")] protected BlockEditorPropertyEditor( IDataValueEditorFactory dataValueEditorFactory, - PropertyEditorCollection propertyEditors) - : this( - dataValueEditorFactory, - propertyEditors, - StaticServiceProvider.Instance.GetRequiredService()) + PropertyEditorCollection propertyEditors, + IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) + : this(dataValueEditorFactory, propertyEditors, blockValuePropertyIndexValueFactory, DependencyInjection.StaticServiceProvider.Instance.GetRequiredService()) { } @@ -29,8 +28,9 @@ public abstract class BlockEditorPropertyEditor : BlockListPropertyEditorBase protected BlockEditorPropertyEditor( IDataValueEditorFactory dataValueEditorFactory, PropertyEditorCollection propertyEditors, - IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) - : base(dataValueEditorFactory, blockValuePropertyIndexValueFactory) + IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory, + IJsonSerializer jsonSerializer) + : base(dataValueEditorFactory, blockValuePropertyIndexValueFactory, jsonSerializer) { PropertyEditors = propertyEditors; } diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditor.cs index 438871b8b4..b3855609b0 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditor.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; +using Umbraco.Cms.Core.Serialization; using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Core.PropertyEditors; @@ -24,28 +25,15 @@ public class BlockListPropertyEditor : BlockEditorPropertyEditor private readonly IEditorConfigurationParser _editorConfigurationParser; private readonly IIOHelper _ioHelper; - // Scheduled for removal in v12 - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 13.")] - public BlockListPropertyEditor( - IDataValueEditorFactory dataValueEditorFactory, - PropertyEditorCollection propertyEditors, - IIOHelper ioHelper) - : this(dataValueEditorFactory, propertyEditors, ioHelper, StaticServiceProvider.Instance.GetRequiredService()) - { - } - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 13.")] + [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 15.")] public BlockListPropertyEditor( IDataValueEditorFactory dataValueEditorFactory, PropertyEditorCollection propertyEditors, IIOHelper ioHelper, - IEditorConfigurationParser editorConfigurationParser) - : this( - dataValueEditorFactory, - propertyEditors, - ioHelper, - editorConfigurationParser, - StaticServiceProvider.Instance.GetRequiredService()) + IEditorConfigurationParser editorConfigurationParser, + IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) + : this(dataValueEditorFactory, propertyEditors, ioHelper, editorConfigurationParser, blockValuePropertyIndexValueFactory, StaticServiceProvider.Instance.GetRequiredService()) { } @@ -55,8 +43,9 @@ public class BlockListPropertyEditor : BlockEditorPropertyEditor PropertyEditorCollection propertyEditors, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser, - IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) - : base(dataValueEditorFactory, propertyEditors, blockValuePropertyIndexValueFactory) + IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory, + IJsonSerializer jsonSerializer) + : base(dataValueEditorFactory, propertyEditors, blockValuePropertyIndexValueFactory, jsonSerializer) { _ioHelper = ioHelper; _editorConfigurationParser = editorConfigurationParser; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs index 99296e788d..d7199404fc 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs @@ -8,6 +8,7 @@ using Umbraco.Cms.Core.Serialization; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; using Umbraco.Cms.Web.Common.DependencyInjection; +using StaticServiceProvider = Umbraco.Cms.Core.DependencyInjection.StaticServiceProvider; namespace Umbraco.Cms.Core.PropertyEditors; @@ -18,18 +19,22 @@ public abstract class BlockListPropertyEditorBase : DataEditor { private readonly IBlockValuePropertyIndexValueFactory _blockValuePropertyIndexValueFactory; + private readonly IJsonSerializer _jsonSerializer; - [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 13.")] - protected BlockListPropertyEditorBase(IDataValueEditorFactory dataValueEditorFactory) - : this(dataValueEditorFactory, StaticServiceProvider.Instance.GetRequiredService()) + + + [Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 15.")] + protected BlockListPropertyEditorBase(IDataValueEditorFactory dataValueEditorFactory, IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) + : this(dataValueEditorFactory,blockValuePropertyIndexValueFactory, StaticServiceProvider.Instance.GetRequiredService()) { } - protected BlockListPropertyEditorBase(IDataValueEditorFactory dataValueEditorFactory, IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) + protected BlockListPropertyEditorBase(IDataValueEditorFactory dataValueEditorFactory, IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory, IJsonSerializer jsonSerializer) : base(dataValueEditorFactory) { _blockValuePropertyIndexValueFactory = blockValuePropertyIndexValueFactory; + _jsonSerializer = jsonSerializer; SupportsReadOnly = true; } @@ -41,7 +46,7 @@ public abstract class BlockListPropertyEditorBase : DataEditor /// Instantiates a new for use with the block list editor property value editor. /// /// A new instance of . - protected virtual BlockEditorDataConverter CreateBlockEditorDataConverter() => new BlockListEditorDataConverter(); + protected virtual BlockEditorDataConverter CreateBlockEditorDataConverter() => new BlockListEditorDataConverter(_jsonSerializer); protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!, CreateBlockEditorDataConverter()); diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs index d3b00d064d..3db625c530 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs @@ -256,9 +256,7 @@ public class BackOfficeController : UmbracoController return await RenderDefaultOrProcessExternalLoginAsync( result, //The default view to render when there is no external login info or errors - () => View(viewPath), - //The IActionResult to perform if external login is successful - () => Redirect("/")); + () => View(viewPath)); } /// diff --git a/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj b/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj index 313dd1ec68..76b6132870 100644 --- a/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj +++ b/src/Umbraco.Web.UI.New/Umbraco.Web.UI.New.csproj @@ -1,8 +1,8 @@ Umbraco.Cms.Web.UI.New + false false - false @@ -12,15 +12,15 @@ - - all - + + + - - + + diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueEditorReuseTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueEditorReuseTests.cs index 6acce32ec3..0e027326a6 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueEditorReuseTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueEditorReuseTests.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; @@ -35,10 +35,10 @@ public class DataValueEditorReuseTests _dataValueEditorFactoryMock .Setup(m => - m.Create(It.IsAny(), It.IsAny())) + m.Create(It.IsAny(), It.IsAny>())) .Returns(() => new BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor( new DataEditorAttribute("a", "b", "c"), - new BlockListEditorDataConverter(), + new BlockListEditorDataConverter(Mock.Of()), _propertyEditorCollection, Mock.Of(), Mock.Of(), @@ -98,7 +98,8 @@ public class DataValueEditorReuseTests new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty)), Mock.Of(), Mock.Of(), - Mock.Of()); + Mock.Of(), + Mock.Of()); // block list is *not* set to reuse its data value editor var dataValueEditor1 = blockListPropertyEditor.GetValueEditor(); @@ -107,7 +108,7 @@ public class DataValueEditorReuseTests Assert.NotNull(dataValueEditor2); Assert.AreNotSame(dataValueEditor1, dataValueEditor2); _dataValueEditorFactoryMock.Verify( - m => m.Create(It.IsAny(), It.IsAny()), + m => m.Create(It.IsAny(), It.IsAny>()), Times.Exactly(2)); } @@ -119,7 +120,8 @@ public class DataValueEditorReuseTests new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty)), Mock.Of(), Mock.Of(), - Mock.Of()); + Mock.Of(), + Mock.Of()); // no matter what, a property editor should never reuse its data value editor when created *with* configuration var dataValueEditor1 = blockListPropertyEditor.GetValueEditor("config"); @@ -130,7 +132,7 @@ public class DataValueEditorReuseTests Assert.AreEqual("config", ((DataValueEditor)dataValueEditor2).ConfigurationObject); Assert.AreNotSame(dataValueEditor1, dataValueEditor2); _dataValueEditorFactoryMock.Verify( - m => m.Create(It.IsAny(), It.IsAny()), + m => m.Create(It.IsAny(), It.IsAny>()), Times.Exactly(2)); } }