From 298c08362473f2e3a905e0ba76b3ce6bcb1b42a2 Mon Sep 17 00:00:00 2001 From: jumagura Date: Mon, 19 Jun 2023 16:52:20 -0400 Subject: [PATCH 1/8] DEV: Add memoization to reduce redis calls --- lib/custom_wizard/custom_field.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/custom_wizard/custom_field.rb b/lib/custom_wizard/custom_field.rb index 29423ec6..07459798 100644 --- a/lib/custom_wizard/custom_field.rb +++ b/lib/custom_wizard/custom_field.rb @@ -90,7 +90,7 @@ class ::CustomWizard::CustomField if attr == 'serializers' && (unsupported = value - CLASSES[klass.to_sym]).length > 0 add_error(I18n.t("#{i18n_key}.unsupported_serializers", - class: klass, + class: klass, serializers: unsupported.join(", ") )) end @@ -140,7 +140,7 @@ class ::CustomWizard::CustomField end def self.cached_list - ::CustomWizard::Cache.wrap(LIST_CACHE_KEY) do + @cached_list ||= ::CustomWizard::Cache.wrap(LIST_CACHE_KEY) do PluginStoreRow.where(plugin_name: NAMESPACE).map do |record| create_from_store(record).as_json.with_indifferent_access end From c8a19e8c857232a4aa36aebeee40e6f09a0f0846 Mon Sep 17 00:00:00 2001 From: jumagura Date: Mon, 19 Jun 2023 16:53:34 -0400 Subject: [PATCH 2/8] bump version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 64d0dc6d..47edb07d 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. -# version: 2.4.4 +# version: 2.4.5 # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech From 78e7ae4e044ed70d6be00fbe8b3249decfef641a Mon Sep 17 00:00:00 2001 From: jumagura Date: Mon, 19 Jun 2023 16:54:23 -0400 Subject: [PATCH 3/8] DEV: Undo formatting change --- lib/custom_wizard/custom_field.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/custom_wizard/custom_field.rb b/lib/custom_wizard/custom_field.rb index 07459798..6e36c2ee 100644 --- a/lib/custom_wizard/custom_field.rb +++ b/lib/custom_wizard/custom_field.rb @@ -90,7 +90,7 @@ class ::CustomWizard::CustomField if attr == 'serializers' && (unsupported = value - CLASSES[klass.to_sym]).length > 0 add_error(I18n.t("#{i18n_key}.unsupported_serializers", - class: klass, + class: klass, serializers: unsupported.join(", ") )) end From a5ebc282cf61cd09fe0ef11469b779403ad4f592 Mon Sep 17 00:00:00 2001 From: jumagura Date: Wed, 21 Jun 2023 00:33:01 -0400 Subject: [PATCH 4/8] DEV: Implement instance-level caching for custom fields --- lib/custom_wizard/custom_field.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/custom_wizard/custom_field.rb b/lib/custom_wizard/custom_field.rb index 6e36c2ee..534953fb 100644 --- a/lib/custom_wizard/custom_field.rb +++ b/lib/custom_wizard/custom_field.rb @@ -216,6 +216,7 @@ class ::CustomWizard::CustomField end def self.invalidate_cache + @cached_list = nil CustomWizard::Cache.new(LIST_CACHE_KEY).delete Discourse.clear_readonly! Discourse.request_refresh! From 29141ab35c45030f9226aa90c1f9645b1d2d7bee Mon Sep 17 00:00:00 2001 From: jumagura Date: Wed, 21 Jun 2023 00:41:45 -0400 Subject: [PATCH 5/8] DEV: Change instance name to a more specific name --- lib/custom_wizard/custom_field.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/custom_wizard/custom_field.rb b/lib/custom_wizard/custom_field.rb index 534953fb..e8c69c8e 100644 --- a/lib/custom_wizard/custom_field.rb +++ b/lib/custom_wizard/custom_field.rb @@ -140,7 +140,7 @@ class ::CustomWizard::CustomField end def self.cached_list - @cached_list ||= ::CustomWizard::Cache.wrap(LIST_CACHE_KEY) do + @custom_wizard_cached_fields ||= ::CustomWizard::Cache.wrap(LIST_CACHE_KEY) do PluginStoreRow.where(plugin_name: NAMESPACE).map do |record| create_from_store(record).as_json.with_indifferent_access end @@ -216,7 +216,7 @@ class ::CustomWizard::CustomField end def self.invalidate_cache - @cached_list = nil + @custom_wizard_cached_fields = nil CustomWizard::Cache.new(LIST_CACHE_KEY).delete Discourse.clear_readonly! Discourse.request_refresh! From a5179e568b0d1ebdb9d69e028ecfdc3a39d9cea8 Mon Sep 17 00:00:00 2001 From: jumagura Date: Wed, 21 Jun 2023 00:44:39 -0400 Subject: [PATCH 6/8] bump version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 47edb07d..c2a2578a 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. -# version: 2.4.5 +# version: 2.4.6 # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech From f08f9f303f5f84fc7867f982d53332f25f746b21 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 22 Jun 2023 06:23:41 +0200 Subject: [PATCH 7/8] Bump version --- plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index c2a2578a..9183ba02 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. -# version: 2.4.6 -# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever +# version: 2.4.5 +# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech # subscription_url: https://coop.pavilion.tech From f8ea4218520b5194fe013bd48446c31bcec90ef7 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 22 Jun 2023 06:25:05 +0200 Subject: [PATCH 8/8] Bump version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 9183ba02..5f166ca0 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. -# version: 2.4.5 +# version: 2.4.7 # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech