Skip to content

Commit 5fed14f

Browse files
author
Claus
committed
deploy-476 Nested content transfer issue
1 parent 97a0ae1 commit 5fed14f

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/Umbraco.Deploy.Contrib.Connectors/GridCellValueConnectors/LeBlenderGridCellValueConnector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class LeBlenderGridCellValueConnector : GridCellValueConnectorBase
1919
private readonly IMacroParser _macroParser;
2020
private readonly Lazy<ValueConnectorCollection> _valueConnectorsLazy;
2121

22+
internal static string MockPropertyTypeAlias = "mockLeBlenderPropertyTypeAlias";
23+
2224
public LeBlenderGridCellValueConnector(IDataTypeService dataTypeService, IMacroParser macroParser, Lazy<ValueConnectorCollection> valueConnectors)
2325
{
2426
if (dataTypeService == null) throw new ArgumentNullException(nameof(dataTypeService));
@@ -193,7 +195,7 @@ public override void SetValue(GridValue.GridControl control, Property property)
193195
continue;
194196
}
195197

196-
var propertyType = new PropertyType(dataType.PropertyEditorAlias, dataType.DatabaseType, "mockPropertyTypeAlias");
198+
var propertyType = new PropertyType(dataType.PropertyEditorAlias, dataType.DatabaseType, MockPropertyTypeAlias);
197199
propertyType.DataTypeDefinitionId = dataType.Id;
198200
// get the value connector for the property type
199201
var propValueConnector = ValueConnectors.Get(propertyType);

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/ArchetypeValueConnector.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class ArchetypeValueConnector : IValueConnector
1919
private readonly Lazy<ValueConnectorCollection> _valueConnectorsLazy;
2020
public virtual IEnumerable<string> PropertyEditorAliases => new[] {"Imulus.Archetype"};
2121

22+
internal static string MockPropertyTypeAlias = "mockArchetypePropertyTypeAlias";
2223
private ValueConnectorCollection ValueConnectors => _valueConnectorsLazy.Value;
2324

2425
public ArchetypeValueConnector(IDataTypeService dataTypeService, IMacroParser macroParser, Lazy<ValueConnectorCollection> valueConnectors)
@@ -181,7 +182,7 @@ public void SetValue(IContentBase content, string alias, string value)
181182
}
182183

183184
// if the macro parser didn't convert the value then try to find a value connector that can and convert it
184-
var propertyType = new PropertyType(dataType.PropertyEditorAlias, dataType.DatabaseType, "mockPropertyTypeAlias");
185+
var propertyType = new PropertyType(dataType.PropertyEditorAlias, dataType.DatabaseType, MockPropertyTypeAlias);
185186
propertyType.DataTypeDefinitionId = dataType.Id;
186187
var propValueConnector = ValueConnectors.Get(propertyType);
187188
var mockProperty = new Property(propertyType);

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/NestedContentValueConnector.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Umbraco.Core.Logging;
99
using Umbraco.Core.Models;
1010
using Umbraco.Core.Services;
11+
using Umbraco.Deploy.Contrib.Connectors.GridCellValueConnectors;
1112
using Umbraco.Deploy.ValueConnectors;
1213

1314
namespace Umbraco.Deploy.Contrib.Connectors.ValueConnectors
@@ -247,7 +248,7 @@ public void SetValue(IContentBase content, string alias, string value)
247248
}
248249

249250
// NestedContent does not use formatting when serializing JSON values
250-
if (nestedContent.Length == 1)
251+
if (nestedContent.Length == 1 && content.Properties[0]?.Alias == LeBlenderGridCellValueConnector.MockPropertyTypeAlias)
251252
value = JObject.FromObject(nestedContent.FirstOrDefault()).ToString(Formatting.None);
252253
else
253254
value = JArray.FromObject(nestedContent).ToString(Formatting.None);

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/VortoValueConnector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class VortoValueConnector : IValueConnector
1919
private readonly IDataTypeService _dataTypeService;
2020
private readonly Lazy<ValueConnectorCollection> _valueConnectorsLazy;
2121

22+
internal static string MockPropertyTypeAlias = "mockVortoPropertyTypeAlias";
23+
2224
public VortoValueConnector(IDataTypeService dataTypeService, Lazy<ValueConnectorCollection> valueConnectors)
2325
{
2426
if (dataTypeService == null) throw new ArgumentNullException(nameof(dataTypeService));
@@ -154,7 +156,7 @@ public void SetValue(IContentBase content, string alias, string value)
154156
if (wrappedDataType == null)
155157
throw new InvalidOperationException($"Could not resolve the datatype used inside the Vorto property: {alias}");
156158

157-
var propertyType = new PropertyType(wrappedDataType, "mockPropertyType");
159+
var propertyType = new PropertyType(wrappedDataType, MockPropertyTypeAlias);
158160
var valueConnector = ValueConnectors.Get(propertyType);
159161

160162
// iterate values for each language

0 commit comments

Comments
 (0)