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
Use current_occurrence directly in 'move' actions
Mir Bhatiad04c84c9ff0d
diff --git a/frontend/src/stimulus/controllers/dynamic/meetings/add-params.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings/add-params.controller.tsindex b0dac604060..cff28f88e42 100644--- a/frontend/src/stimulus/controllers/dynamic/meetings/add-params.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/meetings/add-params.controller.ts@@ -34,14 +34,12 @@ import { appendCollapsedState } from '../../../helpers/collapsible-helper';export default class extends ApplicationController {private turboRequests:TurboRequestsService;- static targets = ['container'];-- declare readonly containerTarget:HTMLElement;static metaNames = ['csrf-token'];declare readonly csrfToken:string;+ // eslint-disable-next-line @typescript-eslint/no-misused-promisesasync connect() {useMeta(this, { suffix: false });const context = await window.OpenProject.getPluginContext();@@ -55,7 +53,6 @@ export default class extends ApplicationController {const url = new URL(target.dataset.href!, window.location.origin);appendCollapsedState(url.searchParams);- url.searchParams.append('current_meeting_id', this.containerTarget.dataset.meeting!);void this.turboRequestsdiff --git a/modules/meeting/app/components/meeting_sections/backlogs/container_component.html.erb b/modules/meeting/app/components/meeting_sections/backlogs/container_component.html.erbindex 83d60ba1d01..637f37e63a0 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/container_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/backlogs/container_component.html.erb@@ -1,5 +1,5 @@<%=- component_wrapper(data: wrapper_data_attributes) do+ component_wrapper doif show?flex_layout(mb: 3) do |flex|flex.with_row(mt: 3) dodiff --git a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rbindex ace1fc7a950..0b1979a7651 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb+++ b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb@@ -47,12 +47,5 @@ module MeetingSectionsdef show?[email protected]? && [email protected]? && @backlogend-- def wrapper_data_attributes- {- "meetings--add-params-target": "container",- meeting: @meeting.id- }- endendenddiff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rbindex 72650648943..c8a692fda82 100644--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb@@ -184,38 +184,21 @@ class MeetingAgendaItemsController < ApplicationControllerrespond_with_turbo_streamsend- def drop # rubocop:disable Metrics/AbcSize+ def dropcurrent_occurrence = Meeting.find_by(id: params[:current_occurrence])meeting_agenda_item_section = @meeting_agenda_item.meeting_sectioncall = if @target_id.nil?::MeetingAgendaItems::UpdateService.new(user: current_user, model: @meeting_agenda_item)- .call(meeting_id: params[:current_meeting_id], meeting_section: nil)+ .call(meeting: current_occurrence, meeting_section: nil)else::MeetingAgendaItems::DropService.new(user: current_user, meeting_agenda_item: @meeting_agenda_item).call(target_id: @target_id, position: @position)end- if call.success?- old_section, current_section, section_changed = assign_drop_results(call, meeting_agenda_item_section)-- if section_changed- move_item_to_other_section_via_turbo_stream(- old_section:,- current_section:,- collapsed: ActiveModel::Type::Boolean.new.cast(params[:collapsed]),- current_occurrence:- )- else- move_item_within_section_via_turbo_stream(current_occurrence:)- end- else- generic_call_failure_response(call)- end-- respond_with_turbo_streams+ handle_agenda_item_update_on_move(call, meeting_agenda_item_section, current_occurrence:)enddef move@@ -261,7 +244,8 @@ class MeetingAgendaItemsController < ApplicationControllerenddef move_to_section_dialog- meeting = params[:current_meeting_id].present? ? Meeting.find(params[:current_meeting_id]) : @meeting_agenda_item.meeting+ meeting = params[:current_occurrence].present? ? Meeting.find(params[:current_occurrence]) : @meeting_agenda_item.meeting+respond_with_dialog MeetingAgendaItems::MoveToSectionDialogComponent.new(agenda_item: @meeting_agenda_item,meeting:@@ -276,23 +260,7 @@ class MeetingAgendaItemsController < ApplicationController.new(user: current_user, model: @meeting_agenda_item).call(meeting_section:)- if call.success?- old_section, current_section, section_changed = assign_drop_results(call, meeting_agenda_item_section)-- if section_changed- move_item_to_other_section_via_turbo_stream(- old_section:,- current_section:,- collapsed: ActiveModel::Type::Boolean.new.cast(params[:collapsed])- )- else- move_item_within_section_via_turbo_stream- end- else- generic_call_failure_response(call)- end-- respond_with_turbo_streams+ handle_agenda_item_update_on_move(call, meeting_agenda_item_section, current_occurrence: nil)endprivate@@ -371,7 +339,7 @@ class MeetingAgendaItemsController < ApplicationControllerdef assign_drop_params # rubocop:disable Metrics/AbcSize@target_id, @position =if params[:type] == "to_current"- meeting = Meeting.find_by(id: params[:current_meeting_id])+ meeting = Meeting.find_by(id: params[:current_occurrence])section = meeting.sections.reorder(position: :desc).first[section&.id, section&.last_position]elsif params[:type] == "to_backlog"@@ -394,4 +362,25 @@ class MeetingAgendaItemsController < ApplicationController[old_section, current_section, section_changed]end++ def handle_agenda_item_update_on_move(call, meeting_agenda_item_section, current_occurrence:)+ if call.success?+ old_section, current_section, section_changed = assign_drop_results(call, meeting_agenda_item_section)++ if section_changed+ move_item_to_other_section_via_turbo_stream(+ old_section:,+ current_section:,+ collapsed: ActiveModel::Type::Boolean.new.cast(params[:collapsed]),+ current_occurrence:+ )+ else+ move_item_within_section_via_turbo_stream(current_occurrence:)+ end+ else+ generic_call_failure_response(call)+ end++ respond_with_turbo_streams+ endenddiff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rbindex 3ba4cb7cfa7..51f582df21a 100644--- a/modules/meeting/spec/support/pages/meetings/show.rb+++ b/modules/meeting/spec/support/pages/meetings/show.rb@@ -369,8 +369,10 @@ module Pages::Meetingsdef expect_empty_backlogwithin_backlog do- expect(page).to have_text("Drag items here or create a new one")- expect(page).to have_button("Add")+ retry_block do+ expect(page).to have_text("Drag items here or create a new one")+ expect(page).to have_button("Add")+ endendend