diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9b42fc..4b59c6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ Notable changes to uSync.Migrations. The package ships one release line per Umbraco major, so versions track the Umbraco major they target. +## [Unreleased] + +### Fixed + +- The Switcher to True/False migrator renamed `hideLabel` to `showLabels` without inverting + it, so labels hidden in v7/v8 showed after migration and vice versa. It now negates the + value. ([#306](https://github.com/Jumoo/uSyncMigrations/issues/306)) + ## 17.0.3 - 2026-09-11 ### Fixed diff --git a/src/uSync.Migrations.Migrators/Switcher/SwitcherConfigurationMigrator.cs b/src/uSync.Migrations.Migrators/Switcher/SwitcherConfigurationMigrator.cs index e0597f4b..18bb535c 100644 --- a/src/uSync.Migrations.Migrators/Switcher/SwitcherConfigurationMigrator.cs +++ b/src/uSync.Migrations.Migrators/Switcher/SwitcherConfigurationMigrator.cs @@ -1,4 +1,5 @@ using Umbraco.Cms.Core; +using Umbraco.Extensions; using uSync.Core.DataTypes; using uSync.Migrations.Core.Migrators; @@ -14,9 +15,16 @@ public class SwitcherConfigurationMigrator : SyncConfigurationMigratorBase, ICon public override Task> GetMigratedConfigurationAsync(string name, IDictionary configuration) { + // hideLabel is the opposite of showLabels, so negate it. ToString() covers bool, JsonElement and JsonNode. + if (configuration.Remove("hideLabel", out var hideLabel)) + { + var hide = hideLabel?.ToString().TryConvertTo(); + if (hide?.Success == true) + configuration["showLabels"] = !hide.Value.Result; + } + return Task.FromResult(MigratePropertyNames(configuration, new Dictionary { - { "hideLabel", "showLabels" }, { "onLabelText", "onLabel" }, { "offLabelText", "offLabel" }, { "switchOn", "default" }