Skip to content

Commit

Permalink
Merge pull request #15952 from opf/bug/fix-warning-message
Browse files Browse the repository at this point in the history
Fix type-reassignment warning message being shown in cases where it shouldn't
  • Loading branch information
dombesz authored Jun 25, 2024
2 parents c2463bb + 2a2900e commit aad5774
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/controllers/work_packages/moves_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ def set_unavailable_type_in_target_project
if @target_project == @project
false
elsif @target_type.nil?
work_packages_and_descendants = WorkPackageHierarchy.where(ancestor_id: @work_packages.select(:id))
Type.where(id: work_packages_and_descendants.select(:id))
hierarchies = WorkPackageHierarchy
.includes(:ancestor)
.where(ancestor_id: @work_packages.select(:id))
Type.where(id: hierarchies.map { _1.ancestor.type_id })
.select("distinct id")
.pluck(:id)
.difference(@types.pluck(:id))
Expand Down

0 comments on commit aad5774

Please sign in to comment.