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
Update AddToSection to reject the current section
Mir Bhatia032eb5c7b28c
diff --git a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erbindex dffac28f583..57981d80d9c 100644--- a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb@@ -46,7 +46,7 @@ See COPYRIGHT and LICENSE files for more details.endendflex.with_row(mb: 3) do- render(Meeting::AddToSection.new(f, wrapper_id: "move-to-section-dialog", occurrence: @meeting))+ render(Meeting::AddToSection.new(f, wrapper_id: "move-to-section-dialog", occurrence: @meeting, item: @agenda_item))endendenddiff --git a/modules/meeting/app/forms/meeting/add_to_section.rb b/modules/meeting/app/forms/meeting/add_to_section.rbindex 4e933f6de8e..d61f4d66429 100644--- a/modules/meeting/app/forms/meeting/add_to_section.rb+++ b/modules/meeting/app/forms/meeting/add_to_section.rb@@ -55,11 +55,12 @@ class Meeting::AddToSection < ApplicationFormendend- def initialize(wrapper_id: nil, occurrence: nil)+ def initialize(wrapper_id: nil, occurrence: nil, item: nil)super()@wrapper_id = wrapper_id@occurrence = occurrence+ @selected_section = item&.meeting_sectionendprivate@@ -75,6 +76,7 @@ class Meeting::AddToSection < ApplicationFormitems.concat(meeting.sections) if meeting.present? && !meeting.templated?items.concat(@occurrence.sections) if @occurrence.present? && @occurrence != meetingitems.push(meeting.backlog) if meeting.present?+ items.reject! { |i| i == @selected_section } if @selected_section.present?itemsenddiff --git a/modules/meeting/spec/features/move_to_section_spec.rb b/modules/meeting/spec/features/move_to_section_spec.rbindex ce426923da4..568dc0dd6c5 100644--- a/modules/meeting/spec/features/move_to_section_spec.rb+++ b/modules/meeting/spec/features/move_to_section_spec.rb@@ -89,6 +89,28 @@ RSpec.describe "Move agenda items to section", :js doshow_page.expect_agenda_item_in_section(title: "Item to move", section: section2)end+ it "doesn't show the current section in the options list" do+ show_page.visit!+ show_page.expect_agenda_item_in_section(title: "Item to move", section: section1)++ show_page.select_action(agenda_item, I18n.t(:label_agenda_item_move_to_section))++ expect(page).to have_css("#move-to-section-dialog")++ within("#move-to-section-dialog") do+ autocompleter = page.find("opce-autocompleter")+ search_autocomplete autocompleter,+ query: "",+ results_selector: "#move-to-section-dialog"++ expect(page).to have_css(".ng-option", text: "Section 2")+ expect(page).to have_css(".ng-option", text: "Section 3")+ expect(page).to have_css(".ng-option", text: "Agenda backlog")++ expect(page).to have_no_css(".ng-option", text: "Section 1")+ end+ end+it "preserves backlog collapsed state when moving items between sections" doshow_page.visit!