debian-mirror-gitlab/app/services/issues/bulk_update_service.rb

26 lines
689 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Issues
class BulkUpdateService < BaseService
def execute
2015-04-26 12:48:37 +05:30
issues_ids = params.delete(:issues_ids).split(",")
issue_params = params
2014-09-02 18:07:02 +05:30
2016-08-24 12:49:21 +05:30
%i(state_event milestone_id assignee_id add_label_ids remove_label_ids subscription_event).each do |key|
issue_params.delete(key) unless issue_params[key].present?
end
2014-09-02 18:07:02 +05:30
issues = Issue.where(id: issues_ids)
2016-08-24 12:49:21 +05:30
2014-09-02 18:07:02 +05:30
issues.each do |issue|
2015-09-11 14:41:01 +05:30
next unless can?(current_user, :update_issue, issue)
2015-04-26 12:48:37 +05:30
Issues::UpdateService.new(issue.project, current_user, issue_params).execute(issue)
2014-09-02 18:07:02 +05:30
end
{
2015-04-26 12:48:37 +05:30
count: issues.count,
success: !issues.count.zero?
2014-09-02 18:07:02 +05:30
}
end
end
end