From c8a5fe09cdf3beb8921304b93e8e8f6ae5591696 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 14 Apr 2020 19:51:58 +1000 Subject: [PATCH] Fix add_to_group and file type validation --- lib/custom_wizard/actions.rb | 6 +++--- lib/custom_wizard/builder.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/custom_wizard/actions.rb b/lib/custom_wizard/actions.rb index 2fce945c..60ae5524 100644 --- a/lib/custom_wizard/actions.rb +++ b/lib/custom_wizard/actions.rb @@ -106,7 +106,7 @@ class CustomWizard::Action end end - def open_composer + def open_composer if action['custom_title_enabled'] title = mapper.interpolate(action['custom_title']) else @@ -138,7 +138,7 @@ class CustomWizard::Action def add_to_group groups = CustomWizard::Mapper.new( - inputs: action['inputs'], + inputs: action['group'], data: data, user: user, opts: { @@ -167,7 +167,7 @@ class CustomWizard::Action def route_to url = mapper.interpolate(action['url']) - + if action['code'] data[action['code']] = SecureRandom.hex(8) url += "&#{action['code']}=#{data[action['code']]}" diff --git a/lib/custom_wizard/builder.rb b/lib/custom_wizard/builder.rb index 86da0285..985ef175 100644 --- a/lib/custom_wizard/builder.rb +++ b/lib/custom_wizard/builder.rb @@ -165,7 +165,7 @@ class CustomWizard::Builder end end end - + if route_to = data['route_to'] data.delete('route_to') end @@ -305,7 +305,7 @@ class CustomWizard::Builder updater.fields[id] = standardise_boolean(value) end - if type === 'upload' && !validate_file_type(value, file_types) + if type === 'upload' && value.present? && !validate_file_type(value, file_types) updater.errors.add(id, I18n.t('wizard.field.invalid_file', label: label, types: file_types)) end