DEV: Allow setting max_length for field types using the plugin API (#24635)

This commit is contained in:
Daniel Waterworth
2023-11-29 14:17:12 -06:00
committed by GitHub
parent 384a8b17a1
commit eef93ac926
2 changed files with 23 additions and 11 deletions

View File

@@ -114,7 +114,9 @@ module HasCustomFields
get_custom_field_descriptor(key).append_field(target, key, value)
end
def register_custom_field_type(name, type, max_length: DEFAULT_FIELD_DESCRIPTOR.max_length)
def register_custom_field_type(name, type, max_length: nil)
max_length ||= DEFAULT_FIELD_DESCRIPTOR.max_length
if Array === type
Discourse.deprecate(
"Array types for custom fields are deprecated, use type :json instead",