From 345bb310e8e174251d769b0749342179bdbc65a4 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 26 Oct 2022 10:04:50 +0200 Subject: [PATCH 01/18] FEATURE: add can_create_tag --- app/controllers/custom_wizard/admin/wizard.rb | 1 + .../custom_wizard/wizard_field_serializer.rb | 5 +++++ .../templates/components/custom-wizard-field-tag.hbs | 1 + .../templates/components/wizard-custom-field.hbs | 12 ++++++++++++ config/locales/client.en.yml | 1 + lefthook.yml | 6 ------ lib/custom_wizard/builder.rb | 4 ++++ lib/custom_wizard/field.rb | 5 ++++- 8 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/controllers/custom_wizard/admin/wizard.rb b/app/controllers/custom_wizard/admin/wizard.rb index c778bc7e..08e7b6d0 100644 --- a/app/controllers/custom_wizard/admin/wizard.rb +++ b/app/controllers/custom_wizard/admin/wizard.rb @@ -114,6 +114,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController :property, :preview_template, :placeholder, + :can_create_tag, prefill: mapped_params, content: mapped_params, condition: mapped_params, diff --git a/app/serializers/custom_wizard/wizard_field_serializer.rb b/app/serializers/custom_wizard/wizard_field_serializer.rb index d5f57060..56e86cc8 100644 --- a/app/serializers/custom_wizard/wizard_field_serializer.rb +++ b/app/serializers/custom_wizard/wizard_field_serializer.rb @@ -17,6 +17,7 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer :property, :content, :tag_groups, + :can_create_tag, :validations, :max_length, :char_counter, @@ -98,6 +99,10 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer object.tag_groups end + def can_create_tag + object.can_create_tag + end + def validations validations = {} object.validations&.each do |type, props| diff --git a/assets/javascripts/discourse/templates/components/custom-wizard-field-tag.hbs b/assets/javascripts/discourse/templates/components/custom-wizard-field-tag.hbs index fb45db4e..90679ae7 100644 --- a/assets/javascripts/discourse/templates/components/custom-wizard-field-tag.hbs +++ b/assets/javascripts/discourse/templates/components/custom-wizard-field-tag.hbs @@ -5,4 +5,5 @@ everyTag=true options=(hash maximum=field.limit + allowAny=field.can_create_tag )}} diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs index 6e524fe3..6273f9a9 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs @@ -222,6 +222,18 @@ }} + +
+
+ +
+ +
+ {{input + type="checkbox" + checked=field.can_create_tag}} +
+
{{/if}} {{#wizard-subscription-container}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 267f099f..e5954a22 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -277,6 +277,7 @@ en: prefill: "Prefill" content: "Content" tag_groups: "Tag Groups" + can_create_tag: "Can Create Tag" date_time_format: label: "Format" instructions: "Moment.js format" diff --git a/lefthook.yml b/lefthook.yml index 995d1f2a..91d2ad53 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -20,9 +20,6 @@ pre-commit: glob: "*.js" include: "app/assets/javascripts|plugins/.+?/assets/javascripts" run: yarn eslint -f compact --quiet {staged_files} - i18n-lint: - glob: "**/{client,server}.en.yml" - run: bundle exec ruby script/i18n_lint.rb {staged_files} lints: parallel: true @@ -36,6 +33,3 @@ lints: run: yarn prettier --list-different **/*.scss eslint: run: yarn eslint -f compact --quiet --ext .js . - i18n-lint: - glob: "**/{client,server}.en.yml" - run: bundle exec ruby script/i18n_lint.rb {all_files} diff --git a/lib/custom_wizard/builder.rb b/lib/custom_wizard/builder.rb index 251ec1e5..3b12ad27 100644 --- a/lib/custom_wizard/builder.rb +++ b/lib/custom_wizard/builder.rb @@ -135,6 +135,10 @@ class CustomWizard::Builder params[:limit] = field_template['limit'] end + if field_template['type'] === 'tag' + params[:can_create_tag] = standardise_boolean(field_template['can_create_tag']) + end + if field_template['type'] === 'category' params[:property] = field_template['property'] end diff --git a/lib/custom_wizard/field.rb b/lib/custom_wizard/field.rb index 600f685e..6215fc8c 100644 --- a/lib/custom_wizard/field.rb +++ b/lib/custom_wizard/field.rb @@ -22,6 +22,7 @@ class CustomWizard::Field :property, :content, :tag_groups, + :can_create_tag, :preview_template, :placeholder @@ -47,6 +48,7 @@ class CustomWizard::Field @property = attrs[:property] @content = attrs[:content] @tag_groups = attrs[:tag_groups] + @can_create_tag = attrs[:can_create_tag] @preview_template = attrs[:preview_template] @placeholder = attrs[:placeholder] end @@ -113,7 +115,8 @@ class CustomWizard::Field limit: nil, prefill: nil, content: nil, - tag_groups: nil + tag_groups: nil, + can_create_tag: false }, category: { limit: 1, From f76ae370b0a7451d88ffc73a4b20c0a4dd39f273 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 26 Oct 2022 10:08:14 +0200 Subject: [PATCH 02/18] Update plugin version --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 6837e83b..8d23068d 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.0.6 +# version: 2.1.0 # 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 54e6af52e99e54097ec6785dc902eb0638f42952 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 7 Nov 2022 14:43:46 +0100 Subject: [PATCH 03/18] Update quit text on first step --- config/locales/client.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index e5954a22..b3adf8d4 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -16,7 +16,7 @@ en: x_characters: one: "%{count} Character" other: "%{count} Characters" - quit: "Maybe Later" + quit: "Exit" done_custom: "Done" back: "Back" next: "Next" From 28e007536a3913307c068973a4102e22eca448f1 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 7 Nov 2022 15:04:30 +0100 Subject: [PATCH 04/18] IMPROVE: Allow upload button on mobile --- .../discourse/components/custom-wizard-composer-editor.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/custom-wizard-composer-editor.js.es6 b/assets/javascripts/discourse/components/custom-wizard-composer-editor.js.es6 index 92c56ea1..5e2ef424 100644 --- a/assets/javascripts/discourse/components/custom-wizard-composer-editor.js.es6 +++ b/assets/javascripts/discourse/components/custom-wizard-composer-editor.js.es6 @@ -149,7 +149,7 @@ export default ComposerEditor.extend({ extraButtons(toolbar) { const component = this; - if (this.allowUpload && this.uploadIcon && !this.site.mobileView) { + if (this.allowUpload && this.uploadIcon) { toolbar.addButton({ id: "upload", group: "insertions", From e50ce9e5c0421072adfd14b8820dba091d468446 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 7 Nov 2022 15:05:13 +0100 Subject: [PATCH 05/18] Update plugin.rb --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 8d23068d..d092790f 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.1.0 +# version: 2.1.1 # 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 9064b2fcbb86c43a79b5584ecb601675940c6ca7 Mon Sep 17 00:00:00 2001 From: Wan Bachtiar Date: Fri, 11 Nov 2022 15:56:07 +1100 Subject: [PATCH 06/18] Patch for wizard URL path to take account of Discourse with subdirectory base URL. --- .../discourse/controllers/admin-wizards-wizard-show.js.es6 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 index e6b0ad04..74c239fe 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 @@ -36,6 +36,10 @@ export default Controller.extend({ @discourseComputed("wizard.id") wizardUrl(wizardId) { + let baseUrl = (window.location.href).split('/admin'); + if (baseUrl.length > 1) { + return baseUrl[0] + "/w/" + dasherize(wizardId); + } return window.location.origin + "/w/" + dasherize(wizardId); }, From d68cd4a9fb2c967af48512bf5fee153b0784c498 Mon Sep 17 00:00:00 2001 From: Wan Bachtiar Date: Fri, 11 Nov 2022 16:36:18 +1100 Subject: [PATCH 07/18] Bump version --- .../discourse/controllers/admin-wizards-wizard-show.js.es6 | 2 +- plugin.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 index 74c239fe..21777c07 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 @@ -39,7 +39,7 @@ export default Controller.extend({ let baseUrl = (window.location.href).split('/admin'); if (baseUrl.length > 1) { return baseUrl[0] + "/w/" + dasherize(wizardId); - } + } return window.location.origin + "/w/" + dasherize(wizardId); }, diff --git a/plugin.rb b/plugin.rb index d092790f..2b35cc81 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.1.1 +# version: 2.1.2 # 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 d6ee1501d1ab8365b0be6a04ba9f2b1ecba2e493 Mon Sep 17 00:00:00 2001 From: Wan Bachtiar Date: Fri, 11 Nov 2022 20:43:57 +1100 Subject: [PATCH 08/18] prettier --- .../discourse/controllers/admin-wizards-wizard-show.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 index 21777c07..c2fff7fe 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 @@ -36,7 +36,7 @@ export default Controller.extend({ @discourseComputed("wizard.id") wizardUrl(wizardId) { - let baseUrl = (window.location.href).split('/admin'); + let baseUrl = window.location.href.split("/admin"); if (baseUrl.length > 1) { return baseUrl[0] + "/w/" + dasherize(wizardId); } From 5b923f3340cc1cdd9d2fe9e5009c266dc4d4c85a Mon Sep 17 00:00:00 2001 From: Wan Bachtiar Date: Thu, 17 Nov 2022 08:59:53 +1100 Subject: [PATCH 09/18] Removed conditional statement that would always be true --- .../discourse/controllers/admin-wizards-wizard-show.js.es6 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 index c2fff7fe..c9a80e0e 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 @@ -37,10 +37,7 @@ export default Controller.extend({ @discourseComputed("wizard.id") wizardUrl(wizardId) { let baseUrl = window.location.href.split("/admin"); - if (baseUrl.length > 1) { - return baseUrl[0] + "/w/" + dasherize(wizardId); - } - return window.location.origin + "/w/" + dasherize(wizardId); + return baseUrl[0] + "/w/" + dasherize(wizardId); }, @discourseComputed("wizard.after_time_scheduled") From d0d2921c17e436a59fa1d02dbb6cee553381bb76 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 7 Dec 2022 10:52:12 +0100 Subject: [PATCH 10/18] Create SECURITY.md --- SECURITY.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..d784e80c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +The security of Discourse plugins are premised on the security of [Discourse](https://github.com/discourse/discourse). Please first consider whether a security issue is best reported and handled by the Discourse team. You can view the Discourse security policy [here]([url](https://github.com/discourse/discourse/security/policy)). + +## Reporting a Vulnerability + +If you find a security vulnerability that is specific to this plugin, please report it to development@pavilion.tech. All commits specific to security are prefixed with SECURITY. From ecbbd5e1eee574c15adb18907dfff0a58da78ea3 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 7 Dec 2022 10:53:01 +0100 Subject: [PATCH 11/18] Update SECURITY.md --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index d784e80c..bb832dc3 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,6 @@ # Security Policy -The security of Discourse plugins are premised on the security of [Discourse](https://github.com/discourse/discourse). Please first consider whether a security issue is best reported and handled by the Discourse team. You can view the Discourse security policy [here]([url](https://github.com/discourse/discourse/security/policy)). +The security of Discourse plugins are premised on the security of [Discourse](https://github.com/discourse/discourse). Please first consider whether a security issue is best reported and handled by the Discourse team. You can view the Discourse security policy [here](https://github.com/discourse/discourse/security/policy). ## Reporting a Vulnerability From 2828ee9c062753579960756356a3cfa928d1204f Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 7 Dec 2022 10:54:44 +0100 Subject: [PATCH 12/18] Update SECURITY.md --- SECURITY.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index bb832dc3..05ae3b47 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,4 +4,6 @@ The security of Discourse plugins are premised on the security of [Discourse](ht ## Reporting a Vulnerability -If you find a security vulnerability that is specific to this plugin, please report it to development@pavilion.tech. All commits specific to security are prefixed with SECURITY. +If you find a security vulnerability that is specific to this plugin, please report it to development@pavilion.tech.\ + +Security issues always take precedence over all other work. All commits specific to security are prefixed with SECURITY. From 93ea792972f4ddb08096dc6f316d7764c9a72aed Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 7 Dec 2022 10:55:02 +0100 Subject: [PATCH 13/18] Update SECURITY.md --- SECURITY.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 05ae3b47..c799fa5a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,6 +4,4 @@ The security of Discourse plugins are premised on the security of [Discourse](ht ## Reporting a Vulnerability -If you find a security vulnerability that is specific to this plugin, please report it to development@pavilion.tech.\ - -Security issues always take precedence over all other work. All commits specific to security are prefixed with SECURITY. +If you find a security vulnerability that is specific to this plugin, please report it to development@pavilion.tech. Security issues always take precedence over all other work. All commits specific to security are prefixed with SECURITY. From 405a4e3ffab1ab6adbf583db1b20159ca39bc30c Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 12 Dec 2022 13:19:04 +0100 Subject: [PATCH 14/18] Add avatar interpolation support --- .../components/wizard-text-editor.js.es6 | 3 +- lib/custom_wizard/mapper.rb | 13 ++++++++ spec/components/custom_wizard/mapper_spec.rb | 31 ++++++++++++++++++- spec/fixtures/mapper/inputs.json | 8 +++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 index 88d7200c..50e5c2e1 100644 --- a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 +++ b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 @@ -6,7 +6,6 @@ import Component from "@ember/component"; import I18n from "I18n"; const excludedUserProperties = [ - "avatar", "profile_background", "card_background", ]; @@ -57,7 +56,7 @@ export default Component.extend({ @discourseComputed("wizardActions") wizardActionList(wizardActions) { - return wizardActions.map((a) => ` w{${a.id}}`); + return (wizardActions || []).map((a) => ` w{${a.id}}`); }, actions: { diff --git a/lib/custom_wizard/mapper.rb b/lib/custom_wizard/mapper.rb index aa444de1..b677a710 100644 --- a/lib/custom_wizard/mapper.rb +++ b/lib/custom_wizard/mapper.rb @@ -211,6 +211,8 @@ class CustomWizard::Mapper user.send(value) elsif USER_OPTION_FIELDS.include?(value) user.user_option.send(value) + elsif value.include?('avatar') + get_avatar_url(value) else nil end @@ -269,4 +271,15 @@ class CustomWizard::Mapper def bool(value) ActiveRecord::Type::Boolean.new.cast(value) end + + def get_avatar_url(value) + parts = value.split('.') + valid_sizes = Discourse.avatar_sizes.to_a + + if value === 'avatar' || parts.size === 1 || valid_sizes.exclude?(parts.last.to_i) + user.small_avatar_url + else + user.avatar_template_url.gsub("{size}", parts.last) + end + end end diff --git a/spec/components/custom_wizard/mapper_spec.rb b/spec/components/custom_wizard/mapper_spec.rb index 111558a4..9fd02e9d 100644 --- a/spec/components/custom_wizard/mapper_spec.rb +++ b/spec/components/custom_wizard/mapper_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true - describe CustomWizard::Mapper do fab!(:user1) { Fabricate(:user, @@ -254,6 +253,36 @@ describe CustomWizard::Mapper do user: user1 ).perform).to eq("Time: #{Time.now.strftime("%B %-d, %Y")}") end + + it "avatar" do + expect(CustomWizard::Mapper.new( + inputs: inputs['interpolate_avatar'], + data: data, + user: user1 + ).perform).to eq("Avatar: ![avatar](#{user1.small_avatar_url})") + end + + it "avatar with invalid size" do + avatar_inputs = inputs['interpolate_avatar'].dup + avatar_inputs[0]["output"] = "Avatar: ![avatar](u{avatar.345})" + + expect(CustomWizard::Mapper.new( + inputs: avatar_inputs, + data: data, + user: user1 + ).perform).to eq("Avatar: ![avatar](#{user1.small_avatar_url})") + end + + it "avatar with valid size" do + avatar_inputs = inputs['interpolate_avatar'].dup + avatar_inputs[0]["output"] = "Avatar: ![avatar](u{avatar.120})" + + expect(CustomWizard::Mapper.new( + inputs: avatar_inputs, + data: data, + user: user1 + ).perform).to eq("Avatar: ![avatar](#{user1.avatar_template_url.gsub("{size}", "120")})") + end end it "handles greater than pairs" do diff --git a/spec/fixtures/mapper/inputs.json b/spec/fixtures/mapper/inputs.json index 443f186b..3fd406a4 100644 --- a/spec/fixtures/mapper/inputs.json +++ b/spec/fixtures/mapper/inputs.json @@ -89,6 +89,14 @@ "output": "Time: v{time}" } ], + "interpolate_avatar": [ + { + "type": "assignment", + "output_type": "text", + "output_connector": "set", + "output": "Avatar: ![avatar](u{avatar})" + } + ], "validation": [ { "type": "validation", From 6a6b44a469eba4a20cffe62b4652d6003be157db Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 12 Dec 2022 13:21:26 +0100 Subject: [PATCH 15/18] Version bump --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 2b35cc81..73701d84 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.1.2 +# version: 2.1.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 621360df58cec93dab058ef15bab98c84fa31949 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 12 Dec 2022 13:24:12 +0100 Subject: [PATCH 16/18] Update wizard-text-editor.js.es6 --- .../discourse/components/wizard-text-editor.js.es6 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 index 50e5c2e1..428fcfb4 100644 --- a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 +++ b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 @@ -5,10 +5,7 @@ import { scheduleOnce } from "@ember/runloop"; import Component from "@ember/component"; import I18n from "I18n"; -const excludedUserProperties = [ - "profile_background", - "card_background", -]; +const excludedUserProperties = ["profile_background", "card_background"]; export default Component.extend({ classNames: "wizard-text-editor", From 528585db45e5980c47d09f1a93c8ae0e567b5409 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 13 Dec 2022 15:21:56 +0100 Subject: [PATCH 17/18] Ensure that we're mapping an array --- .../javascripts/discourse/components/wizard-text-editor.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 index 428fcfb4..b6d07cef 100644 --- a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 +++ b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 @@ -48,7 +48,7 @@ export default Component.extend({ @discourseComputed("wizardFields") wizardFieldList(wizardFields) { - return wizardFields.map((f) => ` w{${f.id}}`); + return (wizardFields || []).map((f) => ` w{${f.id}}`); }, @discourseComputed("wizardActions") From 4fbcc9b84938d47feab024aa56c7fac3f61312b9 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 13 Dec 2022 15:56:20 +0100 Subject: [PATCH 18/18] Update mapper_spec.rb --- spec/components/custom_wizard/mapper_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/components/custom_wizard/mapper_spec.rb b/spec/components/custom_wizard/mapper_spec.rb index 9fd02e9d..56778a07 100644 --- a/spec/components/custom_wizard/mapper_spec.rb +++ b/spec/components/custom_wizard/mapper_spec.rb @@ -1,4 +1,5 @@ -# frozen_string_literal: true +# rubocop:disable Style/FrozenStringLiteralComment + describe CustomWizard::Mapper do fab!(:user1) { Fabricate(:user,