diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-17 23:09:01 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-17 23:09:01 +0400 |
commit | 6149dba5189b9f32b3a9caf0c4c585a973ec99fb (patch) | |
tree | f5209d55e56cd4d663971102bf0366301105e72a /app/services/notes | |
parent | a7f3672b75dff07688c5e4196ad1835bb89ff690 (diff) |
Remove NotesObserver
Diffstat (limited to 'app/services/notes')
-rw-r--r-- | app/services/notes/create_service.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index ff6dfb61139..f64006a4edc 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -1,10 +1,25 @@ module Notes class CreateService < BaseService def execute - note = project.notes.new(params[:note]) + note = project.notes.new(params) note.author = current_user note.system = false - note.save + + if note.save + notification_service.new_note(note) + + # Skip system notes, like status changes and cross-references. + unless note.system + event_service.leave_note(note, note.author) + + # Create a cross-reference note if this Note contains GFM that names an + # issue, merge request, or commit. + note.references.each do |mentioned| + Note.create_cross_reference_note(mentioned, note.noteable, note.author, note.project) + end + end + end + note end end |