From b7575a3295265e06ebf2e6203d326cccfc177f28 Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Sat, 30 Oct 2021 16:07:16 +0530 Subject: [PATCH] use standard naming for custom fields --- extensions/guardian.rb | 4 ++-- lib/custom_wizard/action.rb | 4 ++-- plugin.rb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/guardian.rb b/extensions/guardian.rb index f00cf9e8..96ceda93 100644 --- a/extensions/guardian.rb +++ b/extensions/guardian.rb @@ -21,7 +21,7 @@ module CustomWizardGuardian end 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.presence end @@ -38,7 +38,7 @@ module CustomWizardGuardian submission_data = begin 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 categories = wizard_actions.map do |action| diff --git a/lib/custom_wizard/action.rb b/lib/custom_wizard/action.rb index b2ce05bc7..0c2532ef 100644 --- a/lib/custom_wizard/action.rb +++ b/lib/custom_wizard/action.rb @@ -517,8 +517,8 @@ class CustomWizard::Action skip_validations: true, topic_opts: { custom_fields: { - wizard_created: @wizard.id, - wizard_submission: @wizard.current_submission.id + wizard_id: @wizard.id, + wizard_submission_id: @wizard.current_submission.id } } } diff --git a/plugin.rb b/plugin.rb index 4dbce4b4..961e45cd 100644 --- a/plugin.rb +++ b/plugin.rb @@ -119,12 +119,12 @@ after_initialize do Liquid::Template.register_filter(::CustomWizard::LiquidFilter::FirstNonEmpty) - add_to_class(:topic, :wizard_created) do - custom_fields['wizard_created'] + add_to_class(:topic, :wizard_id) do + custom_fields['wizard_id'] end - add_to_class(:topic, :wizard_submission) do - custom_fields['wizard_submission'] + add_to_class(:topic, :wizard_submission_id) do + custom_fields['wizard_submission_id'] end add_class_method(:wizard, :user_requires_completion?) do |user|