Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Do not add the default validation context multiple times in the Project#validation_context override.

Dombi Attila68ae1c83b0ea
diff --git a/app/models/project.rb b/app/models/project.rb
index f368c165fa2..3f8f81abd2c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -119,7 +119,7 @@ class Project < ApplicationRecord
def validation_context
case Array(super)
in [*, :saving_custom_fields, *] => context
- context << default_validation_context
+ context | [default_validation_context]
else
super
end
diff --git a/spec/services/work_packages/update_service_integration_spec.rb b/spec/services/work_packages/update_service_integration_spec.rb
index fba68ec6fa0..50ebcd1a889 100644
--- a/spec/services/work_packages/update_service_integration_spec.rb
+++ b/spec/services/work_packages/update_service_integration_spec.rb
@@ -1561,6 +1561,8 @@ RSpec.describe WorkPackages::UpdateService, "integration", type: :model do
# the `self_and_ancestors` association is loaded in an `after_save` hook. In order to happen,
# we must validate or save a record again after it was already saved in the current request.
# Once the issue is fixed, it is safe to remove the association reset.
+ # https://github.com/rails/rails/issues/54807
+
work_package.association(:self_and_ancestors).reset
expect(subject).to be_success