Project

General

Profile

Defect #33206 » full_qualified_version_class_version2.patch

Alexander Meindl, 2020-03-29 09:33

View differences:

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