diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-05 10:38:44 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-05 10:38:44 +0200 |
commit | 22d5d8913bfadb409a66e8ff8543d25bab868015 (patch) | |
tree | 011e48ab1cd5f8d3cf9ce725b803f5f45116f059 | |
parent | 1498de225cb0a4c4ac8a3954bde2c9597518c36c (diff) | |
parent | b7d20f14c6008a857a16977a92bb87002683059d (diff) | |
download | gitlab-ce-22d5d8913bfadb409a66e8ff8543d25bab868015.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/api/commits.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/commits_spec.rb | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index fe6b0bcee95..3df8e7ea516 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -139,6 +139,7 @@ v 7.10.4 - Fix DB error when trying to tag a repository (Stan Hu) - Fix Error 500 when searching Wiki pages (Stan Hu) - Unescape branch names in compare commit (Stan Hu) + - Order commit comments chronologically in API. v 7.10.2 - Fix CI links on MR page diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 23270b1c0f4..f4efb651eb6 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -62,7 +62,7 @@ module API sha = params[:sha] commit = user_project.commit(sha) not_found! 'Commit' unless commit - notes = Note.where(commit_id: commit.id) + notes = Note.where(commit_id: commit.id).order(:created_at) present paginate(notes), with: Entities::CommitNote end diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 9ea60e1a4ad..a1c248c636e 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -9,6 +9,7 @@ describe API::API, api: true do let!(:master) { create(:project_member, user: user, project: project, access_level: ProjectMember::MASTER) } let!(:guest) { create(:project_member, user: user2, project: project, access_level: ProjectMember::GUEST) } let!(:note) { create(:note_on_commit, author: user, project: project, commit_id: project.repository.commit.id, note: 'a comment on a commit') } + let!(:another_note) { create(:note_on_commit, author: user, project: project, commit_id: project.repository.commit.id, note: 'another comment on a commit') } before { project.team << [user, :reporter] } @@ -89,7 +90,7 @@ describe API::API, api: true do get api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}/comments", user) expect(response.status).to eq(200) expect(json_response).to be_an Array - expect(json_response.length).to eq(1) + expect(json_response.length).to eq(2) expect(json_response.first['note']).to eq('a comment on a commit') expect(json_response.first['author']['id']).to eq(user.id) end |