summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/merge_requests_controller.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb
index f882028fcab..609589d6b0b 100644
--- a/app/controllers/merge_requests_controller.rb
+++ b/app/controllers/merge_requests_controller.rb
@@ -2,7 +2,7 @@ class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
- before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs]
+ before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs, :automerge]
layout "project"
# Authorize
@@ -95,6 +95,22 @@ class MergeRequestsController < ApplicationController
end
end
+ def automerge
+ message = ""
+ if GitlabMerge.new(@merge_request).merge
+ @merge_request.update_attributes(
+ :author_id_of_changes => current_user.id,
+ :closed => true
+ )
+ @merge_request.reload_code
+ message = "Successfully merged"
+ else
+ message = "Can not be merged"
+ end
+
+ redirect_to [@merge_request.project, @merge_request], :alert => message
+ end
+
def destroy
@merge_request.destroy