Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 10:40:28 +01:00
FIX: Use wizard_submission_id instead of new value
Dieser Commit ist enthalten in:
Ursprung
3433bd4141
Commit
1d2f75951f
2 geänderte Dateien mit 5 neuen und 2 gelöschten Zeilen
|
@ -63,7 +63,6 @@ class CustomWizard::Action
|
||||||
|
|
||||||
def create_topic
|
def create_topic
|
||||||
params = basic_topic_params.merge(public_topic_params)
|
params = basic_topic_params.merge(public_topic_params)
|
||||||
params[:from_wizard] = true
|
|
||||||
|
|
||||||
callbacks_for(:before_create_topic).each do |acb|
|
callbacks_for(:before_create_topic).each do |acb|
|
||||||
params = acb.call(params, @wizard, @action, @submission)
|
params = acb.call(params, @wizard, @action, @submission)
|
||||||
|
|
|
@ -239,10 +239,14 @@ after_initialize do
|
||||||
|
|
||||||
on(:before_create_topic) do |topic_params, user|
|
on(:before_create_topic) do |topic_params, user|
|
||||||
next if topic_params[:archetype] == 'message'
|
next if topic_params[:archetype] == 'message'
|
||||||
if topic_params[:category]&.custom_fields&.[]('create_topic_wizard').present? && !topic_params[:from_wizard]
|
category = topic_params.category
|
||||||
|
wizard_submission_id = topic_params.custom_fields['wizard_submission_id']
|
||||||
|
|
||||||
|
if category&.custom_fields&.[]('create_topic_wizard').present? && wizard_submission_id.blank?
|
||||||
raise Discourse::InvalidParameters.new(
|
raise Discourse::InvalidParameters.new(
|
||||||
I18n.t('wizard.error_messages.wizard_replacing_composer')
|
I18n.t('wizard.error_messages.wizard_replacing_composer')
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren