ensure wizard exists before forcing redirect
Dieser Commit ist enthalten in:
Ursprung
80e5bcc0dc
Commit
62ee016c7c
2 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
|
@ -182,6 +182,10 @@ class CustomWizard::Wizard
|
||||||
PluginStore.get('custom_wizard', wizard_id)
|
PluginStore.get('custom_wizard', wizard_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.exists?(wizard_id)
|
||||||
|
PluginStoreRow.exists?(plugin_name: 'custom_wizard', key: wizard_id)
|
||||||
|
end
|
||||||
|
|
||||||
def self.create(user, wizard_id)
|
def self.create(user, wizard_id)
|
||||||
CustomWizard::Wizard.new(user, self.find(wizard_id).to_h)
|
CustomWizard::Wizard.new(user, self.find(wizard_id).to_h)
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,9 @@ after_initialize do
|
||||||
CustomWizard::Wizard.set_submission_redirect(current_user, wizard_id, request.referer)
|
CustomWizard::Wizard.set_submission_redirect(current_user, wizard_id, request.referer)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to "/w/#{wizard_id.dasherize}"
|
if CustomWizard::Wizard.exists?(wizard_id)
|
||||||
|
redirect_to "/w/#{wizard_id.dasherize}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren