Merge remote-tracking branch 'origin/v10/dev' into v11/dev

# Conflicts:
#	src/JsonSchema/AppSettings.cs
This commit is contained in:
Bjarke Berg
2023-08-09 15:27:01 +02:00
9 changed files with 117 additions and 18 deletions

View File

@@ -14,14 +14,14 @@ namespace Umbraco.Cms.Core.PropertyEditors;
/// </summary>
internal class BlockEditorValues
{
private readonly Lazy<Dictionary<Guid, IContentType>> _contentTypes;
private readonly BlockEditorDataConverter _dataConverter;
private readonly IContentTypeService _contentTypeService;
private readonly ILogger _logger;
public BlockEditorValues(BlockEditorDataConverter dataConverter, IContentTypeService contentTypeService, ILogger logger)
{
_contentTypes = new Lazy<Dictionary<Guid, IContentType>>(() => contentTypeService.GetAll().ToDictionary(c => c.Key));
_dataConverter = dataConverter;
_contentTypeService = contentTypeService;
_logger = logger;
}
@@ -66,11 +66,7 @@ internal class BlockEditorValues
return blockEditorData;
}
private IContentType? GetElementType(BlockItemData item)
{
_contentTypes.Value.TryGetValue(item.ContentTypeKey, out IContentType? contentType);
return contentType;
}
private IContentType? GetElementType(BlockItemData item) => _contentTypeService.Get(item.ContentTypeKey);
private bool ResolveBlockItemData(BlockItemData block, Dictionary<string, Dictionary<string, IPropertyType>> contentTypePropertyTypes)
{

View File

@@ -1,10 +1,14 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -14,12 +18,22 @@ internal sealed class BlockValuePropertyIndexValueFactory :
{
private readonly IContentTypeService _contentTypeService;
public BlockValuePropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
IJsonSerializer jsonSerializer,
IOptionsMonitor<IndexingSettings> indexingSettings)
: base(propertyEditorCollection, jsonSerializer, indexingSettings)
{
_contentTypeService = contentTypeService;
}
[Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
public BlockValuePropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
IJsonSerializer jsonSerializer)
: base(propertyEditorCollection, jsonSerializer)
: this(propertyEditorCollection, contentTypeService, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService<IOptionsMonitor<IndexingSettings>>())
{
_contentTypeService = contentTypeService;
}

View File

@@ -1,9 +1,13 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.DependencyInjection;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -15,11 +19,22 @@ internal sealed class NestedContentPropertyIndexValueFactory
{
private readonly IContentTypeService _contentTypeService;
public NestedContentPropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
IJsonSerializer jsonSerializer) : base(propertyEditorCollection, jsonSerializer)
IJsonSerializer jsonSerializer,
IOptionsMonitor<IndexingSettings> indexingSettings)
: base(propertyEditorCollection, jsonSerializer, indexingSettings)
{
_contentTypeService = contentTypeService;
}
[Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
public NestedContentPropertyIndexValueFactory(
PropertyEditorCollection propertyEditorCollection,
IContentTypeService contentTypeService,
IJsonSerializer jsonSerializer)
: this(propertyEditorCollection, contentTypeService, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService<IOptionsMonitor<IndexingSettings>>())
{
_contentTypeService = contentTypeService;
}

View File

@@ -1,7 +1,11 @@
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Infrastructure.Examine;
using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.PropertyEditors;
@@ -10,12 +14,23 @@ internal abstract class NestedPropertyIndexValueFactoryBase<TSerialized, TItem>
{
private readonly PropertyEditorCollection _propertyEditorCollection;
protected NestedPropertyIndexValueFactoryBase(
PropertyEditorCollection propertyEditorCollection,
IJsonSerializer jsonSerializer,
IOptionsMonitor<IndexingSettings> indexingSettings)
: base(jsonSerializer, indexingSettings)
{
_propertyEditorCollection = propertyEditorCollection;
}
[Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
protected NestedPropertyIndexValueFactoryBase(
PropertyEditorCollection propertyEditorCollection,
IJsonSerializer jsonSerializer)
: base(jsonSerializer)
: this(propertyEditorCollection, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService<IOptionsMonitor<IndexingSettings>>())
{
_propertyEditorCollection = propertyEditorCollection;
}
[Obsolete("Use the overload that specifies availableCultures, scheduled for removal in v14")]