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 perform select validation when changing name

Klaus Zanders5fc74772bcc5
diff --git a/app/contracts/queries/projects/project_queries/base_contract.rb b/app/contracts/queries/projects/project_queries/base_contract.rb
index 0bb16063e79..28a4261661f 100644
--- a/app/contracts/queries/projects/project_queries/base_contract.rb
+++ b/app/contracts/queries/projects/project_queries/base_contract.rb
@@ -42,7 +42,8 @@ module Queries::Projects::ProjectQueries
length: { maximum: 255 }
validate :name_select_included
- validate :existing_selects
+ # When we only changed the name, we don't need to validate the selects
+ validate :existing_selects, unless: :only_changed_name?
validate :user_is_logged_in
validate :allowed_to_modify_private_query
validate :allowed_to_modify_public_query
@@ -82,5 +83,9 @@ module Queries::Projects::ProjectQueries
errors.add :selects, :nonexistent, column: s.attribute
end
end
+
+ def only_changed_name?
+ model.changed == ["name"]
+ end
end
end