0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-19 23:31:11 +02:00

Also standardise booleans when pre-filling fields

Dieser Commit ist enthalten in:
Angus McLeod 2018-06-29 12:51:59 +10:00
Ursprung 72810b755a
Commit dcee0b3774

Datei anzeigen

@ -144,7 +144,11 @@ class CustomWizard::Builder
end
end
field = step.add_field(params)
if field_template['type'] === 'checkbox'
params[:value] = standardise_boolean(params[:value])
end
step.add_field(params)
if field_template['type'] === 'dropdown'
build_dropdown_list(field, field_template)
@ -216,10 +220,14 @@ class CustomWizard::Builder
## ensure all checkboxes are booleans
if field['type'] === 'checkbox'
updater.fields[field['id']] = value == 'true'
updater.fields[field['id']] = standardise_boolean(value)
end
end
def standardise_boolean(value)
!!HasCustomFields::Helpers::CUSTOM_FIELD_TRUE.include?(value)
end
def create_topic(user, action, data)
if action['custom_title']
title = action['custom_title']