0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

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
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']]}"

Datei anzeigen

@ -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