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
Do not pass down the project.project_custom_field_project_mappings to the CustomFieldRowComponent but call it from the project object.
Dombi Attilad05351b1d812
diff --git a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rbindex 4186ad637aa..3cb77666b6d 100644--- a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb+++ b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.rb@@ -34,12 +34,12 @@ module Projectsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- def initialize(project:, project_custom_field:, project_custom_field_project_mappings:)+ def initialize(project:, project_custom_field:)super@project = project@project_custom_field = project_custom_field- @project_custom_field_project_mappings = project_custom_field_project_mappings+ @project_custom_field_project_mappings = project.project_custom_field_project_mappingsendprivatediff --git a/app/components/projects/settings/project_custom_field_sections/index_component.html.erb b/app/components/projects/settings/project_custom_field_sections/index_component.html.erbindex 93fd9e55e32..5da79313acf 100644--- a/app/components/projects/settings/project_custom_field_sections/index_component.html.erb+++ b/app/components/projects/settings/project_custom_field_sections/index_component.html.erb@@ -24,9 +24,7 @@flex.with_row dorender(Projects::Settings::ProjectCustomFieldSections::ShowComponent.new(project: @project,- project_custom_field_section:,- project_custom_fields: project_custom_field_section.custom_fields,- project_custom_field_project_mappings: @project_custom_field_project_mappings+ project_custom_field_section:))endenddiff --git a/app/components/projects/settings/project_custom_field_sections/index_component.rb b/app/components/projects/settings/project_custom_field_sections/index_component.rbindex 3eeb7667442..38f061e9a5f 100644--- a/app/components/projects/settings/project_custom_field_sections/index_component.rb+++ b/app/components/projects/settings/project_custom_field_sections/index_component.rb@@ -34,16 +34,11 @@ module Projectsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- def initialize(- project:,- project_custom_field_sections:,- project_custom_field_project_mappings:- )+ def initialize(project:, project_custom_field_sections:)super@project = project@project_custom_field_sections = project_custom_field_sections- @project_custom_field_project_mappings = project_custom_field_project_mappingsendprivatediff --git a/app/components/projects/settings/project_custom_field_sections/show_component.html.erb b/app/components/projects/settings/project_custom_field_sections/show_component.html.erbindex 3571e88b9e7..58f145a2f55 100644--- a/app/components/projects/settings/project_custom_field_sections/show_component.html.erb+++ b/app/components/projects/settings/project_custom_field_sections/show_component.html.erb@@ -64,7 +64,6 @@render(Projects::Settings::ProjectCustomFieldSections::CustomFieldRowComponent.new(project: @project,project_custom_field:,- project_custom_field_project_mappings: @project_custom_field_project_mappings,))endenddiff --git a/app/components/projects/settings/project_custom_field_sections/show_component.rb b/app/components/projects/settings/project_custom_field_sections/show_component.rbindex a1ef3289deb..df2b2c634ae 100644--- a/app/components/projects/settings/project_custom_field_sections/show_component.rb+++ b/app/components/projects/settings/project_custom_field_sections/show_component.rb@@ -34,18 +34,12 @@ module Projectsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- def initialize(- project:,- project_custom_field_section:,- project_custom_fields:,- project_custom_field_project_mappings:- )+ def initialize(project:, project_custom_field_section:)super@project = project@project_custom_field_section = project_custom_field_section- @project_custom_fields = project_custom_fields- @project_custom_field_project_mappings = project_custom_field_project_mappings+ @project_custom_fields = project_custom_field_section.custom_fieldsendprivatediff --git a/app/controllers/concerns/admin/settings/project_custom_fields/component_streams.rb b/app/controllers/concerns/admin/settings/project_custom_fields/component_streams.rbindex a9b35de02cf..7acd2087bb5 100644--- a/app/controllers/concerns/admin/settings/project_custom_fields/component_streams.rb+++ b/app/controllers/concerns/admin/settings/project_custom_fields/component_streams.rb@@ -42,6 +42,9 @@ module Admindef update_section_via_turbo_stream(project_custom_field_section:)update_via_turbo_stream(component: ::Settings::ProjectCustomFieldSections::ShowComponent.new(+ # Note: `first_and_last:` argument is necessary here, because we render+ # a single custom field section, and not a list of sections. Calling first?+ # and last? method in the component will not result in an N+1 in this case.project_custom_field_section:))diff --git a/app/controllers/concerns/projects/settings/project_custom_fields/component_streams.rb b/app/controllers/concerns/projects/settings/project_custom_fields/component_streams.rbindex 1ed5c490542..0b126e565c4 100644--- a/app/controllers/concerns/projects/settings/project_custom_fields/component_streams.rb+++ b/app/controllers/concerns/projects/settings/project_custom_fields/component_streams.rb@@ -35,14 +35,12 @@ module Projectsincluded dodef update_sections_via_turbo_stream(project: @project,- project_custom_field_sections: @project_custom_field_sections,- project_custom_field_project_mappings: @project_custom_field_project_mappings+ project_custom_field_sections: @project_custom_field_sections)update_via_turbo_stream(component: ::Projects::Settings::ProjectCustomFieldSections::IndexComponent.new(project:,- project_custom_field_sections:,- project_custom_field_project_mappings:+ project_custom_field_sections:))enddiff --git a/app/controllers/projects/settings/project_custom_fields_controller.rb b/app/controllers/projects/settings/project_custom_fields_controller.rbindex b4c3e7527a0..9dbcb329fe5 100644--- a/app/controllers/projects/settings/project_custom_fields_controller.rb+++ b/app/controllers/projects/settings/project_custom_fields_controller.rb@@ -90,10 +90,6 @@ class Projects::Settings::ProjectCustomFieldsController < Projects::SettingsCont.merge(ProjectCustomField.visible).group(:id, "custom_fields.id").order(:position, :position_in_custom_field_section)-- @project_custom_field_project_mappings = ProjectCustomFieldProjectMapping- .where(project_id: @project.id)- .to_aenddef set_project_custom_field_sectiondiff --git a/app/views/projects/settings/project_custom_fields/show.html.erb b/app/views/projects/settings/project_custom_fields/show.html.erbindex 4ec951b20b7..c6fae909ca8 100644--- a/app/views/projects/settings/project_custom_fields/show.html.erb+++ b/app/views/projects/settings/project_custom_fields/show.html.erb@@ -37,7 +37,6 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Projects::Settings::ProjectCustomFieldSections::IndexComponent.new(project: @project,project_custom_field_sections: @project_custom_field_sections,- project_custom_field_project_mappings: @project_custom_field_project_mappings,)) %></div>