Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
FIX: Refine Topic Creation Hook to Allow Wizard Multi-Step Functionality
Dieser Commit ist enthalten in:
Ursprung
d5aa616ff8
Commit
24d7ca646a
2 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen
|
@ -63,6 +63,7 @@ class CustomWizard::Action
|
|||
|
||||
def create_topic
|
||||
params = basic_topic_params.merge(public_topic_params)
|
||||
params[:from_wizard] = true
|
||||
|
||||
callbacks_for(:before_create_topic).each do |acb|
|
||||
params = acb.call(params, @wizard, @action, @submission)
|
||||
|
|
10
plugin.rb
10
plugin.rb
|
@ -238,11 +238,13 @@ after_initialize do
|
|||
DiscourseEvent.trigger(:custom_wizard_ready)
|
||||
|
||||
on(:before_create_topic) do |topic_params, user|
|
||||
category = topic_params.category
|
||||
if category&.custom_fields&.[]('create_topic_wizard').present?
|
||||
next if topic_params[:archetype] == 'message'
|
||||
|
||||
if topic_params[:category]&.custom_fields&.[]('create_topic_wizard').present? && !topic_params[:from_wizard]
|
||||
raise Discourse::InvalidParameters.new(
|
||||
I18n.t('wizard.error_messages.wizard_replacing_composer')
|
||||
)
|
||||
I18n.t('wizard.error_messages.wizard_replacing_composer')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren