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

Merge pull request #122 from paviliondev/final_step_single_submission_issue

Force second step build to overcome can_access? check
Dieser Commit ist enthalten in:
Angus McLeod 2021-06-16 16:42:35 +10:00 committet von GitHub
Commit cc0b5fcf9f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -23,7 +23,7 @@ class CustomWizard::StepsController < ::ApplicationController
if updater.success?
wizard_id = update_params[:wizard_id]
builder = CustomWizard::Builder.new(wizard_id, current_user)
@wizard = builder.build
@wizard = builder.build(force: true)
current_step = @wizard.find_step(update[:step_id])
current_submission = @wizard.current_submission

Datei anzeigen

@ -30,7 +30,7 @@ class CustomWizard::Builder
def build(build_opts = {}, params = {})
return nil if !SiteSetting.custom_wizard_enabled || !@wizard
return @wizard if !@wizard.can_access?
return @wizard if !@wizard.can_access? && !build_opts[:force]
build_opts[:reset] = build_opts[:reset] || @wizard.restart_on_revisit

Datei anzeigen

@ -173,6 +173,8 @@ describe CustomWizard::Wizard do
progress_step("step_2", acting_user: trusted_user)
progress_step("step_3", acting_user: trusted_user)
@permitted_template["multiple_submissions"] = true
expect(
CustomWizard::Wizard.new(@permitted_template, trusted_user).can_access?
).to eq(true)

Datei anzeigen

@ -3,7 +3,6 @@
"name": "Super Mega Fun Wizard",
"background": "#333333",
"save_submissions": true,
"multiple_submissions": true,
"after_signup": false,
"prompt_completion": false,
"theme_id": 2,