Skip to content
Snippets Groups Projects
Commit d08e1db9 authored by AlexDenisov's avatar AlexDenisov
Browse files

Cleanup bulk issues update a bit

parent d79592a7
No related branches found
No related tags found
1 merge request!3956Issues bulk update
Loading
Loading
@@ -8,6 +8,13 @@ module Issues
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?
Loading
Loading
@@ -15,16 +22,12 @@ module Issues
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
 
{
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment