0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

FIX: template guest validation not working with validation conditions

Dieser Commit ist enthalten in:
Angus McLeod 2023-03-17 09:05:53 +01:00
Ursprung 7d6456667a
Commit c6dc80f02c
4 geänderte Dateien mit 27 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -84,7 +84,7 @@ class CustomWizard::TemplateValidator
def validate_guests(object, type)
guests_permitted = @data[:permitted] && @data[:permitted].any? do |m|
m["output"].include?(CustomWizard::Wizard::GUEST_GROUP_ID)
m["output"]&.include?(CustomWizard::Wizard::GUEST_GROUP_ID)
end
return unless guests_permitted

Datei anzeigen

@ -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.11
# version: 2.2.12
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
# url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech

Datei anzeigen

@ -9,6 +9,7 @@ describe CustomWizard::TemplateValidator do
let(:composer_preview) { get_wizard_fixture("field/composer_preview") }
let(:guests_permitted) { get_wizard_fixture("wizard/guests_permitted") }
let(:upload_field) { get_wizard_fixture("field/upload") }
let(:validation_condition) { get_wizard_fixture("condition/validation_condition") }
let(:valid_liquid_template) {
<<-LIQUID.strip
@ -182,6 +183,13 @@ describe CustomWizard::TemplateValidator do
CustomWizard::TemplateValidator.new(template).perform
).to eq(true)
end
it "validates settings with validation conditions" do
template[:permitted] = validation_condition["condition"]
expect(
CustomWizard::TemplateValidator.new(template).perform
).to eq(true)
end
end
context "steps" do

Datei anzeigen

@ -0,0 +1,17 @@
{
"condition": [
{
"type": "validation",
"pairs": [
{
"index": 0,
"key": "trust_level",
"key_type": "user_field",
"value": "2",
"value_type": "text",
"connector": "greater_or_equal"
}
]
}
]
}