Commit d08e1db9 authored by AlexDenisov's avatar AlexDenisov
Browse files

Cleanup bulk issues update a bit

parent 979ea6e076a1
......@@ -8,6 +8,13 @@ def execute
assignee_id = update_data[:assignee_id]
status = update_data[:status]
unless status.present?
return {
count: 0,
success: false
}
end
opts = {}
opts[:milestone_id] = milestone_id if milestone_id.present?
opts[:assignee_id] = assignee_id if assignee_id.present?
......@@ -15,16 +22,12 @@ def execute
issues = Issue.where(id: issues_ids).all
issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
new_state = :reopen
new_state = :close if status == 'closed'
issues.each do |issue|
issue.update_attributes(opts)
if status.present?
if status == 'closed'
issue.close
else
issue.reopen
end
end
issue.send new_state
end
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment