summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-10 12:25:43 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-10 12:25:43 +0300
commit7edf65d1ee9e65e5d5d2bde573936715b46e250d (patch)
treeba9b081f456b1749a4845f2a0ec907202dcf6c54 /app/models/note.rb
parentf055bad5135c8c3934daf16f8d9400f9a23b8960 (diff)
downloadgitlab-ce-7edf65d1ee9e65e5d5d2bde573936715b46e250d.tar.gz
Make a system comment when issue milestone changed
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 278c957af0e..dc8b968c3d2 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -90,6 +90,22 @@ class Note < ActiveRecord::Base
create(note_options, without_protection: true)
end
+ def create_milestone_change_note(noteable, project, author, milestone)
+ body = if milestone.nil?
+ '_Milestone removed_'
+ else
+ "_Milestone changed to #{milestone.title}_"
+ end
+
+ create({
+ noteable: noteable,
+ project: project,
+ author: author,
+ note: body,
+ system: true
+ }, without_protection: true)
+ end
+
def create_assignee_change_note(noteable, project, author, assignee)
body = assignee.nil? ? '_Assignee removed_' : "_Reassigned to @#{assignee.username}_"