diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-20 12:19:19 -0700 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-20 12:19:19 -0700 |
commit | 3d51a6d4351c6a15c92762f5710a967374d0c59b (patch) | |
tree | 10c5e87e0add51ef0bdcc9be42ac0176907a080c /app/workers/merge_worker.rb | |
parent | 8ec5fb138dde9937814ac138352177399d3e776d (diff) | |
parent | 8819007c83fdf1ac642836640a37cc541f6eddc6 (diff) | |
download | gitlab-ce-3d51a6d4351c6a15c92762f5710a967374d0c59b.tar.gz |
Merge branch 'master' into reply-by-email
Diffstat (limited to 'app/workers/merge_worker.rb')
-rw-r--r-- | app/workers/merge_worker.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/workers/merge_worker.rb b/app/workers/merge_worker.rb new file mode 100644 index 00000000000..6a8665c179a --- /dev/null +++ b/app/workers/merge_worker.rb @@ -0,0 +1,19 @@ +class MergeWorker + include Sidekiq::Worker + + sidekiq_options queue: :default + + def perform(merge_request_id, current_user_id, params) + params = params.with_indifferent_access + current_user = User.find(current_user_id) + merge_request = MergeRequest.find(merge_request_id) + + result = MergeRequests::MergeService.new(merge_request.target_project, current_user). + execute(merge_request, params[:commit_message]) + + if result[:status] == :success && params[:should_remove_source_branch].present? + DeleteBranchService.new(merge_request.source_project, current_user). + execute(merge_request.source_branch) + end + end +end |