0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

REFACTOR: Move before_create_topic event handler to plugin.rb

Dieser Commit ist enthalten in:
jumagura 2023-09-19 20:46:42 -04:00
Ursprung 0992e9601c
Commit 0eb6fb1ae0
2 geänderte Dateien mit 9 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -1,10 +0,0 @@
# frozen_string_literal: true
DiscourseEvent.on(:before_create_topic) do |topic_params, user|
category = topic_params.category
if category&.custom_fields&.[]('create_topic_wizard').present?
raise Discourse::InvalidParameters.new(
I18n.t('wizard.error_messages.wizard_replacing_composer')
)
end
end

Datei anzeigen

@ -91,7 +91,6 @@ after_initialize do
../lib/custom_wizard/extensions/invites_controller.rb ../lib/custom_wizard/extensions/invites_controller.rb
../lib/custom_wizard/extensions/users_controller.rb ../lib/custom_wizard/extensions/users_controller.rb
../lib/custom_wizard/extensions/guardian.rb ../lib/custom_wizard/extensions/guardian.rb
../lib/custom_wizard/extensions/topic_extension.rb
../lib/custom_wizard/extensions/custom_field/preloader.rb ../lib/custom_wizard/extensions/custom_field/preloader.rb
../lib/custom_wizard/extensions/custom_field/serializer.rb ../lib/custom_wizard/extensions/custom_field/serializer.rb
../lib/custom_wizard/extensions/custom_field/extension.rb ../lib/custom_wizard/extensions/custom_field/extension.rb
@ -237,4 +236,13 @@ after_initialize do
end end
DiscourseEvent.trigger(:custom_wizard_ready) 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?
raise Discourse::InvalidParameters.new(
I18n.t('wizard.error_messages.wizard_replacing_composer')
)
end
end
end end