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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
move @is_leaf resetting to different module
ulfertsa8bc7b6c18ee
diff --git a/app/models/work_package/parent.rb b/app/models/work_package/parent.rbindex 3e759d5c383..d1b37968d2e 100644--- a/app/models/work_package/parent.rb+++ b/app/models/work_package/parent.rb@@ -113,6 +113,9 @@ module WorkPackage::Parentdef reload(*args)@parent_object = nil+ # The is_leaf resetting stems fro typed_dag_defaults.rb where it was impossible to add+ # another #reload method without interfering with the virtual attribute handling defined here.+ reset_is_leafsuperenddiff --git a/app/models/work_package/typed_dag_defaults.rb b/app/models/work_package/typed_dag_defaults.rbindex 3bceab0c96d..80ddb4df909 100644--- a/app/models/work_package/typed_dag_defaults.rb+++ b/app/models/work_package/typed_dag_defaults.rb@@ -38,11 +38,6 @@ module WorkPackage::TypedDagDefaults# Can't use .alias here# as the dag methods are mixed in later- def reload(*args)- @is_leaf = nil- super- end-def leaveshierarchy_leavesend@@ -56,6 +51,8 @@ module WorkPackage::TypedDagDefaults# rails will attempt to do the performant check on whether such a relation exists at all. While# This is performant for one call, subsequent calls have to again fetch from the db (cached admittedly)# as the relations are still not loaded.+ # For reasons I could not find out, adding a #reload method here lead to the virtual attribute management for parent+ # to no longer work. Resetting the @is_leaf method was hence moved to the WorkPackage::Parent module@is_leaf ||= hierarchy_leaf?end@@ -70,5 +67,11 @@ module WorkPackage::TypedDagDefaultsdef root?hierarchy_root?end++ private++ def reset_is_leaf+ @is_leaf = nil+ endendend