Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 02:50:28 +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:
Commit
cc0b5fcf9f
4 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
|
@ -23,7 +23,7 @@ class CustomWizard::StepsController < ::ApplicationController
|
||||||
if updater.success?
|
if updater.success?
|
||||||
wizard_id = update_params[:wizard_id]
|
wizard_id = update_params[:wizard_id]
|
||||||
builder = CustomWizard::Builder.new(wizard_id, current_user)
|
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_step = @wizard.find_step(update[:step_id])
|
||||||
current_submission = @wizard.current_submission
|
current_submission = @wizard.current_submission
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CustomWizard::Builder
|
||||||
|
|
||||||
def build(build_opts = {}, params = {})
|
def build(build_opts = {}, params = {})
|
||||||
return nil if !SiteSetting.custom_wizard_enabled || !@wizard
|
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
|
build_opts[:reset] = build_opts[:reset] || @wizard.restart_on_revisit
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,8 @@ describe CustomWizard::Wizard do
|
||||||
progress_step("step_2", acting_user: trusted_user)
|
progress_step("step_2", acting_user: trusted_user)
|
||||||
progress_step("step_3", acting_user: trusted_user)
|
progress_step("step_3", acting_user: trusted_user)
|
||||||
|
|
||||||
|
@permitted_template["multiple_submissions"] = true
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
CustomWizard::Wizard.new(@permitted_template, trusted_user).can_access?
|
CustomWizard::Wizard.new(@permitted_template, trusted_user).can_access?
|
||||||
).to eq(true)
|
).to eq(true)
|
||||||
|
|
1
spec/fixtures/wizard.json
gevendort
1
spec/fixtures/wizard.json
gevendort
|
@ -3,7 +3,6 @@
|
||||||
"name": "Super Mega Fun Wizard",
|
"name": "Super Mega Fun Wizard",
|
||||||
"background": "#333333",
|
"background": "#333333",
|
||||||
"save_submissions": true,
|
"save_submissions": true,
|
||||||
"multiple_submissions": true,
|
|
||||||
"after_signup": false,
|
"after_signup": false,
|
||||||
"prompt_completion": false,
|
"prompt_completion": false,
|
||||||
"theme_id": 2,
|
"theme_id": 2,
|
||||||
|
|
Laden …
In neuem Issue referenzieren