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
committerRémy Coutable <remy@rymai.me>2017-11-08 19:04:15 +0300
commitbf13746fd8c7af1ef2e28e8a5a46cf0229b31eb8 (patch)
treedd9da0f599dd7a9b96097af281ef39c116e6e572 /lib
parentf6fb47854974dfa44443555e0e8371053fd73e45 (diff)
parentfec48c6e170fb0032cece5d8cc3b06bb45caee57 (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
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