Skip to content

Commit 19a9d8b

Browse files
committed
renaming some variables and logged properties.
1 parent c49f5a8 commit 19a9d8b

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,25 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
5151

5252
if (string.IsNullOrWhiteSpace(svalue))
5353
{
54-
_logger.Warn<BlockEditorValueConnector>($"Value is null or whitespace. Skipping creating artifact.");
54+
_logger.Warn<BlockEditorValueConnector>($"Value is null or whitespace. Skipping conversion to artifact.");
5555
return null;
5656
}
5757

5858
if (svalue.DetectIsJson() == false)
5959
{
60-
_logger.Warn<BlockListValueConnector>("Value {Value} is not a json string. Skipping creating artifact.",
61-
svalue);
60+
_logger.Warn<BlockListValueConnector>("Value '{Value}' is not a json string. Skipping conversion to artifact.", svalue);
6261
return null;
6362
}
6463

6564
var blockEditorValue = JsonConvert.DeserializeObject<BlockEditorValue>(svalue);
6665

6766
if (blockEditorValue == null)
6867
{
69-
_logger.Warn<BlockEditorValueConnector>("Deserialized value is null. Skipping creating artifact.");
68+
_logger.Warn<BlockEditorValueConnector>("Deserialized value is null. Skipping conversion to artifact.");
7069
return null;
7170
}
7271

73-
var allBlocks = blockEditorValue.Content.Concat(blockEditorValue.Settings);
72+
var allBlocks = blockEditorValue.Content.Concat(blockEditorValue.Settings).ToList();
7473

7574
// get all the content types used in block editor items
7675
var allContentTypes = allBlocks.Select(x => x.ContentTypeKey)
@@ -101,23 +100,23 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
101100

102101
foreach (var key in block.PropertyValues.Keys.ToArray())
103102
{
104-
var propType = contentType.CompositionPropertyTypes.FirstOrDefault(x => x.Alias == key);
103+
var innerPropertyType = contentType.CompositionPropertyTypes.FirstOrDefault(x => x.Alias == key);
105104

106-
if (propType == null)
105+
if (innerPropertyType == null)
107106
{
108-
_logger.Warn<BlockEditorValueConnector>("No property type found with alias {Key} on content type {ContentTypeAlias}.", key, contentType.Alias);
107+
_logger.Warn<BlockEditorValueConnector>("No property type found with alias {PropertyTypeAlias} on content type {ContentTypeAlias}.", key, contentType.Alias);
109108
continue;
110109
}
111110

112111
// fetch the right value connector from the collection of connectors, intended for use with this property type.
113112
// throws if not found - no need for a null check
114-
var propValueConnector = ValueConnectors.Get(propType);
113+
var propertyValueConnector = ValueConnectors.Get(innerPropertyType);
115114

116115
// pass the value, property type and the dependencies collection to the connector to get a "artifact" value
117-
var val = block.PropertyValues[key];
118-
object parsedValue = propValueConnector.ToArtifact(val, propType, dependencies);
116+
var innerValue = block.PropertyValues[key];
117+
object parsedValue = propertyValueConnector.ToArtifact(innerValue, innerPropertyType, dependencies);
119118

120-
_logger.Debug<BlockEditorValueConnector>("Mapped {Key} value '{PropertyValue}' to '{ParsedValue}' using {PropValueConnectorType} for {PropTypeAlias}.", key, block.PropertyValues[key], parsedValue, propValueConnector.GetType(), propType.Alias);
119+
_logger.Debug<BlockEditorValueConnector>("Mapped {Key} value '{PropertyValue}' to '{ParsedValue}' using {PropertyValueConnectorType} for {PropertyTypeAlias}.", key, block.PropertyValues[key], parsedValue, propertyValueConnector.GetType(), innerPropertyType.Alias);
121120

122121
parsedValue = parsedValue?.ToString();
123122

0 commit comments

Comments
 (0)