diff options
Diffstat (limited to 'app/services/notes/load_service.rb')
-rw-r--r-- | app/services/notes/load_service.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/services/notes/load_service.rb b/app/services/notes/load_service.rb new file mode 100644 index 00000000000..f7ad7d60a3a --- /dev/null +++ b/app/services/notes/load_service.rb @@ -0,0 +1,20 @@ +module Notes + class LoadService < BaseService + def execute + target_type = params[:target_type] + target_id = params[:target_id] + + + @notes = case target_type + when "commit" + project.notes.for_commit_id(target_id).not_inline.fresh + when "issue" + project.issues.find(target_id).notes.inc_author.fresh + when "merge_request" + project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh + when "snippet" + project.snippets.find(target_id).notes.fresh + end + end + end +end |