From ebea3e666afbb1009afbfc533566ca9085ac65bc Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 2 Mar 2023 10:36:06 +0100 Subject: [PATCH 1/3] FIX: Client-side exception fixes --- assets/javascripts/discourse/lib/wizard-schema.js.es6 | 6 +++++- .../discourse/routes/admin-wizards-wizard.js.es6 | 3 ++- plugin.rb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index dcb60a0e..5309a813 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -241,6 +241,10 @@ const custom_field = { type: ["string", "boolean", "integer", "json"], }; +export function buildFieldTypes(types) { + wizardSchema.field.types = types; +} + field.type = Object.keys(field.types); action.type = Object.keys(action.types); @@ -260,7 +264,7 @@ export function buildFieldValidations(validations) { export function filterValues(currentWizard, feature, attribute, values = null) { values = values || wizardSchema[feature][attribute]; - if (currentWizard.allowGuests) { + if (currentWizard && currentWizard.allowGuests) { const filteredFeature = wizardSchema.filters.allow_guests[feature]; if (filteredFeature) { const filtered = filteredFeature[attribute]; diff --git a/assets/javascripts/discourse/routes/admin-wizards-wizard.js.es6 b/assets/javascripts/discourse/routes/admin-wizards-wizard.js.es6 index 6e42bcbd..b23b63f6 100644 --- a/assets/javascripts/discourse/routes/admin-wizards-wizard.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards-wizard.js.es6 @@ -1,5 +1,5 @@ import DiscourseRoute from "discourse/routes/discourse"; -import { buildFieldValidations } from "../lib/wizard-schema"; +import { buildFieldTypes, buildFieldValidations } from "../lib/wizard-schema"; import EmberObject, { set } from "@ember/object"; import { A } from "@ember/array"; import { all } from "rsvp"; @@ -11,6 +11,7 @@ export default DiscourseRoute.extend({ }, afterModel(model) { + buildFieldTypes(model.field_types); buildFieldValidations(model.realtime_validations); return all([ diff --git a/plugin.rb b/plugin.rb index 78c384da..8cfe6615 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.2.2 +# version: 2.2.3 # 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 0fc2c6b850af7fbce18f03d8dbabe9e0f156b0b9 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 6 Mar 2023 10:00:52 +0100 Subject: [PATCH 2/3] FIX: Ensure tag_groups is in wizard schema --- assets/javascripts/discourse/lib/wizard-schema.js.es6 | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index 5309a813..b0488906 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -72,6 +72,7 @@ const field = { required: null, type: null, condition: null, + tag_groups: null }, types: {}, mapped: ["prefill", "content", "condition", "index"], From 9bb01d29abce73a5875d417ad6cc46cc55edd442 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 8 Mar 2023 11:10:46 +0100 Subject: [PATCH 3/3] Fix prettier issue and bump version --- assets/javascripts/discourse/lib/wizard-schema.js.es6 | 2 +- plugin.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index b0488906..24bda1d3 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -72,7 +72,7 @@ const field = { required: null, type: null, condition: null, - tag_groups: null + tag_groups: null, }, types: {}, mapped: ["prefill", "content", "condition", "index"], diff --git a/plugin.rb b/plugin.rb index 8cfe6615..7422345f 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.2.3 +# version: 2.2.4 # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever # url: https://github.com/paviliondev/discourse-custom-wizard # contact_emails: development@pavilion.tech