From 8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Tue, 21 Apr 2015 15:13:40 +0200 Subject: Use project.commit convenience method. --- lib/api/commits.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/api/commits.rb') diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 0de4e720ffe..23270b1c0f4 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -32,7 +32,7 @@ module API # GET /projects/:id/repository/commits/:sha get ":id/repository/commits/:sha" do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! "Commit" unless commit present commit, with: Entities::RepoCommitDetail end @@ -46,7 +46,7 @@ module API # GET /projects/:id/repository/commits/:sha/diff get ":id/repository/commits/:sha/diff" do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! "Commit" unless commit commit.diffs end @@ -60,7 +60,7 @@ module API # GET /projects/:id/repository/commits/:sha/comments get ':id/repository/commits/:sha/comments' do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! 'Commit' unless commit notes = Note.where(commit_id: commit.id) present paginate(notes), with: Entities::CommitNote @@ -81,7 +81,7 @@ module API required_attributes! [:note] sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! 'Commit' unless commit opts = { note: params[:note], -- cgit v1.2.1