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

use standard naming for custom fields

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-10-30 16:07:16 +05:30
Ursprung dec5f5b5ce
Commit b7575a3295
3 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -21,7 +21,7 @@ module CustomWizardGuardian
end end
def creating_wizard(topic) def creating_wizard(topic)
wizard_id = topic.wizard_created.presence wizard_id = topic.wizard_id.presence
wizard = CustomWizard::Builder.new(wizard_id, @user).build if wizard_id wizard = CustomWizard::Builder.new(wizard_id, @user).build if wizard_id
wizard.presence wizard.presence
end end
@ -38,7 +38,7 @@ module CustomWizardGuardian
submission_data = begin submission_data = begin
submissions = CustomWizard::Submission.list(wizard) submissions = CustomWizard::Submission.list(wizard)
submissions.find { |sub| sub.id == topic.wizard_submission }&.fields_and_meta submissions.find { |sub| sub.id == topic.wizard_submission_id }&.fields_and_meta
end end
categories = wizard_actions.map do |action| categories = wizard_actions.map do |action|

Datei anzeigen

@ -517,8 +517,8 @@ class CustomWizard::Action
skip_validations: true, skip_validations: true,
topic_opts: { topic_opts: {
custom_fields: { custom_fields: {
wizard_created: @wizard.id, wizard_id: @wizard.id,
wizard_submission: @wizard.current_submission.id wizard_submission_id: @wizard.current_submission.id
} }
} }
} }

Datei anzeigen

@ -119,12 +119,12 @@ after_initialize do
Liquid::Template.register_filter(::CustomWizard::LiquidFilter::FirstNonEmpty) Liquid::Template.register_filter(::CustomWizard::LiquidFilter::FirstNonEmpty)
add_to_class(:topic, :wizard_created) do add_to_class(:topic, :wizard_id) do
custom_fields['wizard_created'] custom_fields['wizard_id']
end end
add_to_class(:topic, :wizard_submission) do add_to_class(:topic, :wizard_submission_id) do
custom_fields['wizard_submission'] custom_fields['wizard_submission_id']
end end
add_class_method(:wizard, :user_requires_completion?) do |user| add_class_method(:wizard, :user_requires_completion?) do |user|