Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-10-15 11:41:46 +0300
committerStan Hu <stanhu@gmail.com>2015-10-16 09:54:13 +0300
commit2611d9f63cb6c22a00eccdac75535f93890b176c (patch)
tree2fd094664dc39103a7da10a2583572e22d7bb6c0 /app/services/system_note_service.rb
parentbd3689e9e0aebe43f7c5f787e03a3bbaa8b2ef68 (diff)
Add a system note and update relevant merge requests when a branch is deleted or re-added
If a branch is deleted with an open merge request, amended offline, and then pushed again, GitLab doesn't bother to update the merge request even though the last commit ID and/or code may have changed. This MR ensures that each push will update any relevant merge requests and adds a system note if this happens as well. Closes #2926
Diffstat (limited to 'app/services/system_note_service.rb')
-rw-r--r--app/services/system_note_service.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 8253c1f780d..24e06504078 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -168,6 +168,25 @@ class SystemNoteService
create_note(noteable: noteable, project: project, author: author, note: body)
end
+ # Called when a branch in Noteable is added or deleted
+ #
+ # noteable - Noteable object
+ # project - Project owning noteable
+ # author - User performing the change
+ # branch_type - 'source' or 'target'
+ # branch - branch name
+ # presence - 'deleted' or 'created'
+ #
+ # Example Note text:
+ #
+ # "Target branch `feature` deleted"
+ #
+ # Returns the created Note object
+ def self.change_branch_presence(noteable, project, author, branch_type, branch, presence)
+ body = "#{branch_type} branch `#{branch}` #{presence}".capitalize
+ create_note(noteable: noteable, project: project, author: author, note: body)
+ end
+
# Called when a Mentionable references a Noteable
#
# noteable - Noteable object being referenced