mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Fix empty string custom action resulting in internal error
https://appsignal.com/openproject-gmbh/sites/673c8d4183eb67dcd6c4e764/exceptions/incidents/1037/samples/673c8d4183eb67dcd6c4e764-909226446337628072917766676802 https://community.openproject.org/wp/74131
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user