diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-07 16:37:50 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-07 16:37:50 +0300 |
commit | 1da5a103ace9c346758e9525d7f0fa55bab13599 (patch) | |
tree | 34a492ec3b0ec833556a728faf1ece5a8f060b47 /app/services/notes | |
parent | 7e7f260dc54c7643e8d7ec8bf3fbded3dfc06fcc (diff) | |
parent | dcdfa04b322db3905f6871a6857e7055c556547f (diff) |
Merge branch 'jprovazn-api' into 'master'
Add discussion API
See merge request gitlab-org/gitlab-ce!17510
Diffstat (limited to 'app/services/notes')
-rw-r--r-- | app/services/notes/build_service.rb | 9 | ||||
-rw-r--r-- | app/services/notes/post_process_service.rb | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/services/notes/build_service.rb b/app/services/notes/build_service.rb index abf25bb778b..77e7b8a5ea7 100644 --- a/app/services/notes/build_service.rb +++ b/app/services/notes/build_service.rb @@ -26,14 +26,19 @@ module Notes if project project.notes.find_discussion(discussion_id) else - # only PersonalSnippets can have discussions without project association discussion = Note.find_discussion(discussion_id) noteable = discussion.noteable - return nil unless noteable.is_a?(PersonalSnippet) && can?(current_user, :comment_personal_snippet, noteable) + return nil unless noteable_without_project?(noteable) discussion end end + + def noteable_without_project?(noteable) + return true if noteable.is_a?(PersonalSnippet) && can?(current_user, :comment_personal_snippet, noteable) + + false + end end end diff --git a/app/services/notes/post_process_service.rb b/app/services/notes/post_process_service.rb index 6a10e172483..ad3dcc5010b 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 if @note.for_personal_snippet? + return unless @note.for_project_noteable? @note.create_cross_references! execute_note_hooks |