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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 23:09:01 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 23:09:01 +0400
commit6149dba5189b9f32b3a9caf0c4c585a973ec99fb (patch)
treef5209d55e56cd4d663971102bf0366301105e72a /app/services/notes
parenta7f3672b75dff07688c5e4196ad1835bb89ff690 (diff)
Remove NotesObserver
Diffstat (limited to 'app/services/notes')
-rw-r--r--app/services/notes/create_service.rb19
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