summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-04-05 12:41:01 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-04-05 12:41:01 +0000
commit63a1a57024e54ff6aee1f099ca7b431a7bb0e669 (patch)
tree2cc4cf8dc4fe6a874edfe763d9a498cb41f7f457 /app/services
parentf9607db7a4db87b07ed2f2634794f99084a6534d (diff)
parentc1946364707947f56048cc00caa6d67fe635f3c7 (diff)
downloadgitlab-ce-63a1a57024e54ff6aee1f099ca7b431a7bb0e669.tar.gz
Merge branch 'jprovazn-comment-refs' into 'master'
Better group support in notes-related code See merge request gitlab-org/gitlab-ce!18150
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notes/post_process_service.rb4
-rw-r--r--app/services/system_note_service.rb4
2 files changed, 5 insertions, 3 deletions
diff --git a/app/services/notes/post_process_service.rb b/app/services/notes/post_process_service.rb
index f0cab2ade6d..199b8028dbc 100644
--- a/app/services/notes/post_process_service.rb
+++ b/app/services/notes/post_process_service.rb
@@ -11,7 +11,7 @@ module Notes
unless @note.system?
EventCreateService.new.leave_note(@note, @note.author)
- return unless @note.for_project_noteable?
+ return if @note.for_personal_snippet?
@note.create_cross_references!
execute_note_hooks
@@ -23,6 +23,8 @@ module Notes
end
def execute_note_hooks
+ return unless @note.project
+
note_data = hook_data
hooks_scope = @note.confidential? ? :confidential_note_hooks : :note_hooks
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 2253d638e93..00bf5434b7f 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -429,7 +429,7 @@ module SystemNoteService
def cross_reference(noteable, mentioner, author)
return if cross_reference_disallowed?(noteable, mentioner)
- gfm_reference = mentioner.gfm_reference(noteable.project)
+ gfm_reference = mentioner.gfm_reference(noteable.project || noteable.group)
body = cross_reference_note_content(gfm_reference)
if noteable.is_a?(ExternalIssue)
@@ -582,7 +582,7 @@ module SystemNoteService
text = "#{cross_reference_note_prefix}%#{mentioner.to_reference(nil)}"
notes.where('(note LIKE ? OR note LIKE ?)', text, text.capitalize)
else
- gfm_reference = mentioner.gfm_reference(noteable.project)
+ gfm_reference = mentioner.gfm_reference(noteable.project || noteable.group)
text = cross_reference_note_content(gfm_reference)
notes.where(note: [text, text.capitalize])
end