diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-02 13:46:38 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 09:52:35 +0200 |
commit | 546a3c6561fbe967cc37ccc3229b71893cd20c34 (patch) | |
tree | 0828ab3fb82e2b03921a8f4d1f745f430bae4bd6 /app/controllers/ci | |
parent | 0de7c83a78711601b40b5a739070da2e3af29b11 (diff) | |
download | gitlab-ce-546a3c6561fbe967cc37ccc3229b71893cd20c34.tar.gz |
Refactor commit and build
Diffstat (limited to 'app/controllers/ci')
-rw-r--r-- | app/controllers/ci/builds_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/ci/commits_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/ci/projects_controller.rb | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/ci/builds_controller.rb b/app/controllers/ci/builds_controller.rb index 80ee8666792..bf87f81439a 100644 --- a/app/controllers/ci/builds_controller.rb +++ b/app/controllers/ci/builds_controller.rb @@ -18,7 +18,7 @@ module Ci if commit # Redirect to commit page - redirect_to ci_project_ref_commit_path(@project, @build.commit.ref, @build.commit.sha) + redirect_to ci_project_commit_path(@project, @build.commit) return end end diff --git a/app/controllers/ci/commits_controller.rb b/app/controllers/ci/commits_controller.rb index 7a0a500fbe6..acf9189572c 100644 --- a/app/controllers/ci/commits_controller.rb +++ b/app/controllers/ci/commits_controller.rb @@ -13,7 +13,7 @@ module Ci end def status - commit = Ci::Project.find(params[:project_id]).commits.find_by_sha_and_ref!(params[:id], params[:ref_id]) + commit = Ci::Project.find(params[:project_id]).commits.find_by_sha!(params[:id], params[:ref_id]) render json: commit.to_json(only: [:id, :sha], methods: [:status, :coverage]) rescue ActiveRecord::RecordNotFound render json: { status: "not_found" } @@ -22,7 +22,7 @@ module Ci def cancel commit.builds.running_or_pending.each(&:cancel) - redirect_to ci_project_ref_commits_path(project, commit.ref, commit.sha) + redirect_to ci_project_commits_path(project, commit.sha) end private @@ -32,7 +32,7 @@ module Ci end def commit - @commit ||= Ci::Project.find(params[:project_id]).commits.find_by_sha_and_ref!(params[:id], params[:ref_id]) + @commit ||= Ci::Project.find(params[:project_id]).commits.find_by_sha!(params[:id]) end end end diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index e8788955eba..20e6c2c2ba7 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -19,7 +19,8 @@ module Ci @ref = params[:ref] @commits = @project.commits.reverse_order - @commits = @commits.where(ref: @ref) if @ref + # TODO: this is broken + # @commits = @commits.where(ref: @ref) if @ref @commits = @commits.page(params[:page]).per(20) end |