1
0
Fork 0

Fix add_to_group and file type validation

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-14 19:51:58 +10:00
Ursprung d74831aa06
Commit c8a5fe09cd
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -106,7 +106,7 @@ class CustomWizard::Action
end end
end end
def open_composer def open_composer
if action['custom_title_enabled'] if action['custom_title_enabled']
title = mapper.interpolate(action['custom_title']) title = mapper.interpolate(action['custom_title'])
else else
@ -138,7 +138,7 @@ class CustomWizard::Action
def add_to_group def add_to_group
groups = CustomWizard::Mapper.new( groups = CustomWizard::Mapper.new(
inputs: action['inputs'], inputs: action['group'],
data: data, data: data,
user: user, user: user,
opts: { opts: {
@ -167,7 +167,7 @@ class CustomWizard::Action
def route_to def route_to
url = mapper.interpolate(action['url']) url = mapper.interpolate(action['url'])
if action['code'] if action['code']
data[action['code']] = SecureRandom.hex(8) data[action['code']] = SecureRandom.hex(8)
url += "&#{action['code']}=#{data[action['code']]}" url += "&#{action['code']}=#{data[action['code']]}"

Datei anzeigen

@ -165,7 +165,7 @@ class CustomWizard::Builder
end end
end end
end end
if route_to = data['route_to'] if route_to = data['route_to']
data.delete('route_to') data.delete('route_to')
end end
@ -305,7 +305,7 @@ class CustomWizard::Builder
updater.fields[id] = standardise_boolean(value) updater.fields[id] = standardise_boolean(value)
end 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)) updater.errors.add(id, I18n.t('wizard.field.invalid_file', label: label, types: file_types))
end end