0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

Ensure added fields have a key and value

Dieser Commit ist enthalten in:
Angus McLeod 2018-06-05 12:36:56 +10:00
Ursprung 17ba9976c0
Commit 9bbc72481a

Datei anzeigen

@ -60,7 +60,7 @@ class CustomWizard::Builder
if step_template['fields'] && step_template['fields'].length if step_template['fields'] && step_template['fields'].length
step_template['fields'].each do |field| step_template['fields'].each do |field|
validate_field(field, updater) validate_field(field, updater) if field['type'] != 'text-only'
end end
end end
@ -255,14 +255,11 @@ class CustomWizard::Builder
if action['add_fields'] if action['add_fields']
action['add_fields'].each do |field| action['add_fields'].each do |field|
if field['value_custom'] value = field['value_custom'] ? field['value_custom'] : data[field['value']]
value = field['value_custom']
else
value = data[field['value']]
end
key = field['key'] key = field['key']
if key && key.include?('custom_fields') if key && value
if key.include?('custom_fields')
keyArr = key.split('.') keyArr = key.split('.')
if keyArr.length === 3 if keyArr.length === 3
@ -281,6 +278,7 @@ class CustomWizard::Builder
end end
end end
end end
end
creator = PostCreator.new(user, params) creator = PostCreator.new(user, params)
post = creator.create post = creator.create