mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-24 16:05:00 +08:00
feat: Add support for lowercase and title case keys in custom profile attributes map
This commit is contained in:
@@ -63,16 +63,26 @@ func NewCustomProfileAttributesSelectOptionFromMap(m map[string]any) CustomProfi
|
||||
name := ""
|
||||
color := ""
|
||||
|
||||
// Check for both "Name" and "name"
|
||||
if v, ok := m["Name"]; ok {
|
||||
if vStr, ok := v.(string); ok {
|
||||
name = vStr
|
||||
}
|
||||
} else if v, ok := m["name"]; ok {
|
||||
if vStr, ok := v.(string); ok {
|
||||
name = vStr
|
||||
}
|
||||
}
|
||||
|
||||
// Check for both "Color" and "color"
|
||||
if v, ok := m["Color"]; ok {
|
||||
if vStr, ok := v.(string); ok {
|
||||
color = vStr
|
||||
}
|
||||
} else if v, ok := m["color"]; ok {
|
||||
if vStr, ok := v.(string); ok {
|
||||
color = vStr
|
||||
}
|
||||
}
|
||||
|
||||
return NewCustomProfileAttributesSelectOption(name, color)
|
||||
|
||||
Reference in New Issue
Block a user