Post merge fixes

This commit is contained in:
Bjarke Berg
2023-12-13 15:47:35 +01:00
parent 95094361cc
commit f8dda5a7b5
10 changed files with 72 additions and 88 deletions

View File

@@ -41,8 +41,8 @@
</ItemGroup>
<!-- Third-party packages -->
<ItemGroup>
<PackageVersion Include="Asp.Versioning.Mvc" Version="7.1.1" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="7.1.0" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="8.0.0" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.0.0" />
<PackageVersion Include="Dazinator.Extensions.FileProviders" Version="2.0.0" />
<PackageVersion Include="Examine" Version="3.1.0" />
<PackageVersion Include="Examine.Core" Version="3.1.0" />
@@ -90,4 +90,4 @@
<!-- Both Dazinator.Extensions.FileProviders and MiniProfiler.AspNetCore.Mvc bring in a vulnerable version of System.Text.RegularExpressions -->
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
</Project>
</Project>

View File

@@ -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",

View File

@@ -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<JsonPatch>(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);
}
}

View File

@@ -21,4 +21,8 @@
<ItemGroup>
<EmbeddedResource Include="OpenApi.json" />
</ItemGroup>
<ItemGroup>
<PackageVersion Update="JsonPatch.Net" Version="2.1.0" />
</ItemGroup>
</Project>

View File

@@ -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<IBlockValuePropertyIndexValueFactory>())
PropertyEditorCollection propertyEditors,
IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory)
: this(dataValueEditorFactory, propertyEditors, blockValuePropertyIndexValueFactory, DependencyInjection.StaticServiceProvider.Instance.GetRequiredService<IJsonSerializer>())
{
}
@@ -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;
}

View File

@@ -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<IEditorConfigurationParser>())
{
}
[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<IBlockValuePropertyIndexValueFactory>())
IEditorConfigurationParser editorConfigurationParser,
IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory)
: this(dataValueEditorFactory, propertyEditors, ioHelper, editorConfigurationParser, blockValuePropertyIndexValueFactory, StaticServiceProvider.Instance.GetRequiredService<IJsonSerializer>())
{
}
@@ -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;

View File

@@ -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<IBlockValuePropertyIndexValueFactory>())
[Obsolete("Use non-obsoleted ctor. This will be removed in Umbraco 15.")]
protected BlockListPropertyEditorBase(IDataValueEditorFactory dataValueEditorFactory, IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory)
: this(dataValueEditorFactory,blockValuePropertyIndexValueFactory, StaticServiceProvider.Instance.GetRequiredService<IJsonSerializer>())
{
}
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 <see cref="BlockEditorDataConverter"/> for use with the block list editor property value editor.
/// </summary>
/// <returns>A new instance of <see cref="BlockListEditorDataConverter"/>.</returns>
protected virtual BlockEditorDataConverter<BlockListValue, BlockListLayoutItem> CreateBlockEditorDataConverter() => new BlockListEditorDataConverter();
protected virtual BlockEditorDataConverter<BlockListValue, BlockListLayoutItem> CreateBlockEditorDataConverter() => new BlockListEditorDataConverter(_jsonSerializer);
protected override IDataValueEditor CreateValueEditor() =>
DataValueEditorFactory.Create<BlockListEditorPropertyValueEditor>(Attribute!, CreateBlockEditorDataConverter());

View File

@@ -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));
}
/// <summary>

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RootNamespace>Umbraco.Cms.Web.UI.New</RootNamespace>
<IsPackable>false</IsPackable>
<EnablePackageValidation>false</EnablePackageValidation>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
<Import Project="..\Umbraco.Cms.Targets\buildTransitive\Umbraco.Cms.Targets.props" />
@@ -12,15 +12,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.2.*">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<!-- Add design/build time support for EF Core migrations -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<!-- Ensure the AppLocalIcu setting is the same as the referenced ICU package version and changes are also done to the template project! -->
<!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" VersionOverride="72.1.0.3" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
</ItemGroup>
<PropertyGroup>

View File

@@ -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<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()))
m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter<BlockListValue, BlockListLayoutItem>>()))
.Returns(() => new BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor(
new DataEditorAttribute("a", "b", "c"),
new BlockListEditorDataConverter(),
new BlockListEditorDataConverter(Mock.Of<IJsonSerializer>()),
_propertyEditorCollection,
Mock.Of<IDataTypeService>(),
Mock.Of<IContentTypeService>(),
@@ -98,7 +98,8 @@ public class DataValueEditorReuseTests
new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>)),
Mock.Of<IIOHelper>(),
Mock.Of<IEditorConfigurationParser>(),
Mock.Of<IBlockValuePropertyIndexValueFactory>());
Mock.Of<IBlockValuePropertyIndexValueFactory>(),
Mock.Of<IJsonSerializer>());
// 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<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()),
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter<BlockListValue, BlockListLayoutItem>>()),
Times.Exactly(2));
}
@@ -119,7 +120,8 @@ public class DataValueEditorReuseTests
new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>)),
Mock.Of<IIOHelper>(),
Mock.Of<IEditorConfigurationParser>(),
Mock.Of<IBlockValuePropertyIndexValueFactory>());
Mock.Of<IBlockValuePropertyIndexValueFactory>(),
Mock.Of<IJsonSerializer>());
// 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<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()),
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter<BlockListValue, BlockListLayoutItem>>()),
Times.Exactly(2));
}
}