Merge pull request #23695 from opf/better-move_work_package_to_target_component_via_turbo_stream-arguments

cleaner argument names in move_work_package_to_target_component_via_turbo_stream
This commit is contained in:
Dombi Attila
2026-06-12 15:17:26 +03:00
committed by GitHub
@@ -65,13 +65,13 @@ module Backlogs
def move # rubocop:disable Metrics/AbcSize def move # rubocop:disable Metrics/AbcSize
# Capture the source before the call; the service reloads @work_package internally via #move_after. # Capture the source before the call; the service reloads @work_package internally via #move_after.
source = @work_package.sprint source_sprint = @work_package.sprint
call = ::Backlogs::WorkPackages::UpdateService.new(user: current_user, story: @work_package) call = ::Backlogs::WorkPackages::UpdateService.new(user: current_user, story: @work_package)
.call(**move_params.to_h.symbolize_keys) .call(**move_params.to_h.symbolize_keys)
if call.success? if call.success?
move_work_package_to_target_component_via_turbo_stream(source:, target: call.result.sprint) move_work_package_to_target_component_via_turbo_stream(source_sprint:, target_sprint: call.result.sprint)
if work_package_invisible_after_move?(call.result) if work_package_invisible_after_move?(call.result)
backlog_name = call.result.backlog_bucket&.name || I18n.t(:label_inbox) backlog_name = call.result.backlog_bucket&.name || I18n.t(:label_inbox)
@@ -90,17 +90,17 @@ module Backlogs
private private
def move_work_package_to_target_component_via_turbo_stream(source:, target:) def move_work_package_to_target_component_via_turbo_stream(source_sprint:, target_sprint:)
if source != target if source_sprint != target_sprint
replace_component_via_turbo_stream(source) replace_component_via_turbo_stream(sprint: source_sprint)
end end
replace_component_via_turbo_stream(target) replace_component_via_turbo_stream(sprint: target_sprint)
end end
def replace_component_via_turbo_stream(container) def replace_component_via_turbo_stream(sprint:)
component = if container component = if sprint
sprint_component(sprint: container) sprint_component(sprint:)
else else
backlog_component backlog_component
end end