Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-23 18:00:29 +01:00
FIX: Minor bugfixes in manager and create_group action
(cherry picked from commit 208cb1229a
)
Dieser Commit ist enthalten in:
Ursprung
e07a57e398
Commit
de2faf893f
2 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen
|
@ -48,20 +48,21 @@ class CustomWizard::AdminManagerController < CustomWizard::AdminController
|
||||||
|
|
||||||
imported = []
|
imported = []
|
||||||
failures = []
|
failures = []
|
||||||
|
templates = template_json.is_a?(Array) ? template_json : [template_json]
|
||||||
|
|
||||||
template_json.each do |json|
|
templates.each do |raw_template|
|
||||||
template = CustomWizard::Template.new(json)
|
template = CustomWizard::Template.new(raw_template)
|
||||||
template.save(skip_jobs: true, create: true)
|
template.save(skip_jobs: true, create: true)
|
||||||
|
|
||||||
if template.errors.any?
|
if template.errors.any?
|
||||||
failures.push(
|
failures.push(
|
||||||
id: json['id'],
|
id: template.data['id'],
|
||||||
messages: template.errors.full_messages.join(', ')
|
messages: template.errors.full_messages.join(', ')
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
imported.push(
|
imported.push(
|
||||||
id: json['id'],
|
id: template.data['id'],
|
||||||
name: json['name']
|
name: template.data['name']
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -225,7 +225,7 @@ class CustomWizard::Mapper
|
||||||
end
|
end
|
||||||
|
|
||||||
def interpolate(string, opts = { user: true, wizard: true, value: true, template: false })
|
def interpolate(string, opts = { user: true, wizard: true, value: true, template: false })
|
||||||
return string if string.blank?
|
return string if string.blank? || string.frozen?
|
||||||
|
|
||||||
if opts[:user]
|
if opts[:user]
|
||||||
string.gsub!(/u\{(.*?)\}/) { |match| map_user_field($1) || '' }
|
string.gsub!(/u\{(.*?)\}/) { |match| map_user_field($1) || '' }
|
||||||
|
|
Laden …
In neuem Issue referenzieren