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

linting

ulfertsf759670f43ff
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rb
index 1f682d9e428..75016b09589 100644
--- a/app/contracts/work_packages/base_contract.rb
+++ b/app/contracts/work_packages/base_contract.rb
@@ -155,7 +155,7 @@ module WorkPackages
def validate_enabled_type
# Checks that the issue can not be added/moved to a disabled type
- if model.project && !type_inexistent? && (model.type_id_changed? || model.project_id_changed?)
+ if type_context_changed?
errors.add :type_id, :inclusion unless model.project.types.include?(model.type)
end
end
@@ -310,6 +310,10 @@ module WorkPackages
end
end
+ def type_context_changed?
+ model.project && !type_inexistent? && (model.type_id_changed? || model.project_id_changed?)
+ end
+
def type_inexistent?
model.type.is_a?(Type::InexistentType)
end