Skip to content

Commit

Permalink
Comment up nested content.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Sep 25, 2023
1 parent d306998 commit 216b085
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion uSync.Migrations/Migrators/Optional/NestedToBlockListMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,22 @@ private object GetBlockListConfigFromNestedConfig(NestedContentConfiguration nes
return config;
}

/// <summary>
/// stub of what block list json looks like,
/// </summary>
/// <remarks>
/// if a property has already been converted, then it will have this json in it.
/// </remarks>
private static string blockListJsonStub = "{\r\n \"layout\": {\r\n \"Umbraco.BlockList\":";

/// <summary>
/// convert the content value from nested content to blocklist.
/// </summary>
public override string? GetContentValue(SyncMigrationContentProperty contentProperty, SyncMigrationContext context)
{
if (string.IsNullOrWhiteSpace(contentProperty.Value)) return string.Empty;

if (contentProperty.Value.InvariantStartsWith("{\r\n \"layout\": {\r\n \"Umbraco.BlockList\":"))
if (contentProperty.Value.InvariantStartsWith(blockListJsonStub))
{
_logger.LogDebug("Property [{name}] is already BlockList", contentProperty.EditorAlias);
return contentProperty.Value;
Expand Down

0 comments on commit 216b085

Please sign in to comment.