summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-05-20 21:41:02 +0000
committerDouwe Maan <douwe@gitlab.com>2016-05-20 21:41:02 +0000
commitbaccd1838c92a0d38d3f38b93e9911c97adfef21 (patch)
tree23e42bfa3f6c30d01aee84f2a8cc6cca2d2eba6f /app/models
parentfc1910ddc5db25e608921f69c3dc28d830e6ea03 (diff)
parent7880a300dc9ef3fcceb7f1a6af6a6500b0b46e5c (diff)
downloadgitlab-ce-baccd1838c92a0d38d3f38b93e9911c97adfef21.tar.gz
Merge branch 'rm-source-branch' into 'master'
Allows MR authors to have the source branch removed when merging the MR closes #13191 The location of the checkbox might not be optimal so any feedback is welcome. Any other feedback too obviously. Screenshot: ![Screenshot_2016-02-17_21.25.24](/uploads/a9c3eaafb39c6f5b4f0949a2278af6da/Screenshot_2016-02-17_21.25.24.png) See merge request !2801
Diffstat (limited to 'app/models')
-rw-r--r--app/models/merge_request.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 45ddcf6812a..722c258244c 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -286,6 +286,18 @@ class MergeRequest < ActiveRecord::Base
last_commit == source_project.commit(source_branch)
end
+ def should_remove_source_branch?
+ merge_params['should_remove_source_branch'].present?
+ end
+
+ def force_remove_source_branch?
+ merge_params['force_remove_source_branch'].present?
+ end
+
+ def remove_source_branch?
+ should_remove_source_branch? || force_remove_source_branch?
+ end
+
def mr_and_commit_notes
# Fetch comments only from last 100 commits
commits_for_notes_limit = 100
@@ -426,7 +438,10 @@ class MergeRequest < ActiveRecord::Base
self.merge_when_build_succeeds = false
self.merge_user = nil
- self.merge_params = nil
+ if merge_params
+ merge_params.delete('should_remove_source_branch')
+ merge_params.delete('commit_message')
+ end
self.save
end