summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-05 16:56:36 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-05 16:56:36 +0300
commitb0b05aa28d127452600c800dabb554735a9d7e04 (patch)
tree0711c6a7560f35736321da4e0382ac58a503eb48 /app/models/note.rb
parente088777e1ba1c8fa809f2a6894aea640373c56c1 (diff)
downloadgitlab-ce-b0b05aa28d127452600c800dabb554735a9d7e04.tar.gz
Add comment to merge request when new push happens
It allows track when user added new commits to existing merge request Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 0fa1a7ab615..deda494f475 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -117,6 +117,24 @@ class Note < ActiveRecord::Base
})
end
+ def create_new_commits_note(noteable, project, author, commits)
+ body = "Pushed new commits:\n\n"
+
+ commits.each do |commit|
+ message = "* #{commit.short_id} - #{commit.title}"
+ body << message
+ body << "\n"
+ end
+
+ create(
+ noteable: noteable,
+ project: project,
+ author: author,
+ note: body,
+ system: true
+ )
+ end
+
def discussions_from_notes(notes)
discussion_ids = []
discussions = []