diff --git a/app/models/custom_actions/actions/base.rb b/app/models/custom_actions/actions/base.rb index 3c5a2f377a8..3b131d6f80d 100644 --- a/app/models/custom_actions/actions/base.rb +++ b/app/models/custom_actions/actions/base.rb @@ -46,7 +46,7 @@ class CustomActions::Actions::Base end def value_objects - values.map do |value| + values.filter_map do |value| allowed_values.find { |v| v[:value] == value } end end diff --git a/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.ts b/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.ts index 07e27564e4e..4ca97fd421a 100644 --- a/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.ts +++ b/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.ts @@ -324,6 +324,7 @@ export abstract class EditForm { // silently close the field as it will no longer be writable if (!fieldSchema) { this.closeEditFields([fieldName]); + return; } if (!fieldSchema.writable && !noWarnings) { diff --git a/spec/models/custom_actions/shared_expectations.rb b/spec/models/custom_actions/shared_expectations.rb index 36797bbe06d..59b35e15859 100644 --- a/spec/models/custom_actions/shared_expectations.rb +++ b/spec/models/custom_actions/shared_expectations.rb @@ -140,6 +140,15 @@ RSpec.shared_examples_for "associated custom action" do end end + describe "#value_objects" do + it "does not include nil for values not present in allowed_values" do + instance.values = [""] + + expect(instance.value_objects) + .not_to include(nil) + end + end + it_behaves_like "associated custom action validations" end end