fix: remove unused sanitizeCustomMenuItemsJSON function
Replaced by filterUserVisibleMenuItems which includes both array validation and admin-item filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -244,22 +244,6 @@ func (s *SettingService) GetPublicSettingsForInjection(ctx context.Context) (any
|
||||
}, nil
|
||||
}
|
||||
|
||||
// sanitizeCustomMenuItemsJSON validates a raw JSON string is a valid JSON array
|
||||
// and returns it as json.RawMessage. Returns "[]" if the input is empty, not a
|
||||
// valid JSON array, or is a non-array JSON value (e.g. object, string).
|
||||
func sanitizeCustomMenuItemsJSON(raw string) json.RawMessage {
|
||||
raw = strings.TrimSpace(raw)
|
||||
if raw == "" || raw == "[]" {
|
||||
return json.RawMessage("[]")
|
||||
}
|
||||
// Verify it's actually a JSON array, not an object or other type
|
||||
var arr []json.RawMessage
|
||||
if err := json.Unmarshal([]byte(raw), &arr); err != nil {
|
||||
return json.RawMessage("[]")
|
||||
}
|
||||
return json.RawMessage(raw)
|
||||
}
|
||||
|
||||
// filterUserVisibleMenuItems filters out admin-only menu items from a raw JSON
|
||||
// array string, returning only items with visibility != "admin".
|
||||
func filterUserVisibleMenuItems(raw string) json.RawMessage {
|
||||
|
||||
Reference in New Issue
Block a user