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
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-11-08 19:04:15 +0300
committerWinnie Hellmann <winnie@gitlab.com>2017-11-10 01:13:33 +0300
commitac5815dc3b34ec1de3e91dfdb7828ee1877484ad (patch)
treedd9da0f599dd7a9b96097af281ef39c116e6e572 /lib
parente438e5c593d46154216550825d261a9173641f36 (diff)
Merge branch 'dm-notes-for-commit-id' into 'master'
Use Commit#notes and Note.for_commit_id when possible to make sure we use all indexes available to us Closes #34509 See merge request gitlab-org/gitlab-ce!15253 (cherry picked from commit bf13746fd8c7af1ef2e28e8a5a46cf0229b31eb8)
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commits.rb2
-rw-r--r--lib/api/v3/commits.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 2685dc27252..2bc4039b019 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -117,7 +117,7 @@ module API
commit = user_project.commit(params[:sha])
not_found! 'Commit' unless commit
- notes = user_project.notes.where(commit_id: commit.id).order(:created_at)
+ notes = commit.notes.order(:created_at)
present paginate(notes), with: Entities::CommitNote
end
diff --git a/lib/api/v3/commits.rb b/lib/api/v3/commits.rb
index ed206a6def0..be360fbfc0c 100644
--- a/lib/api/v3/commits.rb
+++ b/lib/api/v3/commits.rb
@@ -106,7 +106,7 @@ module API
commit = user_project.commit(params[:sha])
not_found! 'Commit' unless commit
- notes = Note.where(commit_id: commit.id).order(:created_at)
+ notes = commit.notes.order(:created_at)
present paginate(notes), with: ::API::Entities::CommitNote
end