Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
FIX: template guest validation not working with validation conditions
Dieser Commit ist enthalten in:
Ursprung
7d6456667a
Commit
c6dc80f02c
4 geänderte Dateien mit 27 neuen und 2 gelöschten Zeilen
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
17
spec/fixtures/condition/validation_condition.json
gevendort
Normale Datei
17
spec/fixtures/condition/validation_condition.json
gevendort
Normale Datei
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Laden …
In neuem Issue referenzieren