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
Minor cleanups
Jonas Jabari0abd390ff4b4
diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rbindex 76d4f4bcdbe..cde7c21725f 100644--- a/app/models/projects/acts_as_customizable_patches.rb+++ b/app/models/projects/acts_as_customizable_patches.rb@@ -39,9 +39,6 @@ module Projects::ActsAsCustomizablePatchesdependent: :destroy, inverse_of: :projecthas_many :project_custom_fields, through: :project_custom_field_project_mappings, class_name: 'ProjectCustomField'- before_create :build_missing_project_custom_field_project_mappings- after_save :reset_section_scoped_validation, :set_query_available_custom_fields_to_project_level-# we need to reset the query_available_custom_fields_on_global_level already after validation# as the update service just calls .valid? and returns if invalid# after_save is not touched in this case which causes the flag to stay active@@ -50,12 +47,13 @@ module Projects::ActsAsCustomizablePatchesbefore_update :set_query_available_custom_fields_to_global_levelbefore_create :reject_section_scoped_validation_for_creation+ before_create :build_missing_project_custom_field_project_mappings+after_create :disable_custom_fields_with_empty_values+ after_save :reset_section_scoped_validation, :set_query_available_custom_fields_to_project_leveldef build_missing_project_custom_field_project_mappings# activate custom fields for this project (via mapping table) if values have been provided for custom_fields but no mapping exists- # current shortcommings:- # - boolean custom fields are always activated as a nil value is never provided (always true/false)custom_field_ids = project.custom_values.select { |cv| cv.value.present? }.pluck(:custom_field_id).uniq