chore: load 'assign_default' value from legacy value (#17428)

If this value was set before v2.19.0, then assign_default was in a json
field that would not match. And it would default to `false`. This
corrects that.
This commit is contained in:
Steven Masley
2025-04-16 15:55:37 -05:00
committed by GitHub
parent c4d3dd2791
commit 2e5cd299f2
2 changed files with 79 additions and 0 deletions
+11
View File
@@ -213,6 +213,17 @@ type OrganizationSyncSettings struct {
}
func (s *OrganizationSyncSettings) Set(v string) error {
legacyCheck := make(map[string]any)
err := json.Unmarshal([]byte(v), &legacyCheck)
if assign, ok := legacyCheck["AssignDefault"]; err == nil && ok {
// The legacy JSON key was 'AssignDefault' instead of 'assign_default'
// Set the default value from the legacy if it exists.
isBool, ok := assign.(bool)
if ok {
s.AssignDefault = isBool
}
}
return json.Unmarshal([]byte(v), s)
}