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

Fix validation messages not being displayed when a previous section was closed without saving.

Dombi Attila4c9ceb37ad7a
diff --git a/modules/overviews/app/components/project_custom_fields/sections/edit_dialog_component.rb b/modules/overviews/app/components/project_custom_fields/sections/edit_dialog_component.rb
index 29d2f3d68fd..9e2d7974495 100644
--- a/modules/overviews/app/components/project_custom_fields/sections/edit_dialog_component.rb
+++ b/modules/overviews/app/components/project_custom_fields/sections/edit_dialog_component.rb
@@ -40,6 +40,10 @@ module ProjectCustomFields
@project = project
@project_custom_field_section = project_custom_field_section
end
+
+ def wrapper_uniq_by
+ @project_custom_field_section.id
+ end
end
end
end
diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb
index ddbca5cc622..460d7253ddf 100644
--- a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb
+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb
@@ -254,6 +254,28 @@ RSpec.describe 'Edit project custom fields on project overview page', :js do
end
end
+ describe 'editing multiple sections' do
+ let(:input_fields_dialog) do
+ Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_input_fields)
+ end
+ let(:select_fields_dialog) do
+ Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_select_fields)
+ end
+ let(:field) { FormFields::Primerized::AutocompleteField.new(list_project_custom_field) }
+
+ it 'displays validation errors, when the previous section modal was canceled (Regression)' do
+ list_project_custom_field.update!(is_required: true)
+ list_project_custom_field.custom_values.destroy_all
+
+ overview_page.open_edit_dialog_for_section(section_for_input_fields)
+ input_fields_dialog.close
+ overview_page.open_edit_dialog_for_section(section_for_select_fields)
+ select_fields_dialog.submit
+
+ field.expect_error(I18n.t('activerecord.errors.messages.blank'))
+ end
+ end
+
describe 'with input fields' do
let(:section) { section_for_input_fields }
let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }