mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user