Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 01:10:28 +01:00
Fix add_to_group and file type validation
Dieser Commit ist enthalten in:
Ursprung
d74831aa06
Commit
c8a5fe09cd
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
|
@ -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']]}"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren