Project

General

Profile

Defect #33206 » full_qualified_version_class_version2.patch

Alexander Meindl, 2020-03-29 09:33

View differences:

app/models/issue.rb
1756 1756
    def update_versions(conditions=nil)
1757 1757
      # Only need to update issues with a fixed_version from
1758 1758
      # a different project and that is not systemwide shared
1759
      Issue.joins(:project, :fixed_version).
1760
        where("#{Issue.table_name}.fixed_version_id IS NOT NULL" +
1761
          " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" +
1762
          " AND #{Version.table_name}.sharing <> 'system'").
1763
        where(conditions).each do |issue|
1759
      arel_issues = Arel::Table.new(:issues)
1760
      arel_versions = Arel::Table.new(:versions)
1761
      Issue.joins(:project, :fixed_version)
1762
           .where.not(fixed_version_id: nil)
1763
           .where.not(versions: { sharing: 'system' })
1764
           .where.not(arel_issues[:project_id].eq(arel_versions[:project_id]))
1765
           .where(conditions).each do |issue|
1764 1766
        next if issue.project.nil? || issue.fixed_version.nil?
1765
        unless issue.project.shared_versions.include?(issue.fixed_version)
1766
          issue.init_journal(User.current)
1767
          issue.fixed_version = nil
1768
          issue.save
1769
        end
1767
        next if issue.project.shared_versions.include?(issue.fixed_version)
1768

  
1769
        issue.init_journal(User.current)
1770
        issue.fixed_version = nil
1771
        issue.save
1770 1772
      end
1771 1773
    end
1772 1774
  end
(2-2/2)