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
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-06 21:15:06 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-06 21:15:06 +0300
commit04c7dc2a9e2385ce47a70205eafd4cf4f91a0bba (patch)
tree90d5e2fe65e98654ddd759edc7bf822f1c3fb7df /app/controllers/ci
parentf6223ffb318d2e81ec50037810d23bbd86a400e8 (diff)
Cleanup CI code after refactoring and fix several 500 errors
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/ci')
-rw-r--r--app/controllers/ci/builds_controller.rb40
-rw-r--r--app/controllers/ci/commits_controller.rb6
2 files changed, 5 insertions, 41 deletions
diff --git a/app/controllers/ci/builds_controller.rb b/app/controllers/ci/builds_controller.rb
index bf87f81439a..daf3bcf72a9 100644
--- a/app/controllers/ci/builds_controller.rb
+++ b/app/controllers/ci/builds_controller.rb
@@ -1,41 +1,11 @@
module Ci
class BuildsController < Ci::ApplicationController
- before_action :authenticate_user!, except: [:status, :show]
- before_action :authenticate_public_page!, only: :show
+ before_action :authenticate_user!, except: [:status]
before_action :project
- before_action :authorize_access_project!, except: [:status, :show]
- before_action :authorize_manage_project!, except: [:status, :show, :retry, :cancel]
+ before_action :authorize_access_project!, except: [:status]
+ before_action :authorize_manage_project!, except: [:status, :retry, :cancel]
before_action :authorize_manage_builds!, only: [:retry, :cancel]
- before_action :build, except: [:show]
- layout 'ci/build'
-
- def show
- if params[:id] =~ /\A\d+\Z/
- @build = build
- else
- # try to find commit by sha
- commit = commit_by_sha
-
- if commit
- # Redirect to commit page
- redirect_to ci_project_commit_path(@project, @build.commit)
- return
- end
- end
-
- raise ActiveRecord::RecordNotFound unless @build
-
- @builds = @project.commits.find_by_sha(@build.sha).builds.order('id DESC')
- @builds = @builds.where("id not in (?)", @build.id).page(params[:page]).per(20)
- @commit = @build.commit
-
- respond_to do |format|
- format.html
- format.json do
- render json: @build.to_json(methods: :trace_html)
- end
- end
- end
+ before_action :build
def retry
if @build.commands.blank?
@@ -68,7 +38,7 @@ module Ci
end
def build
- @build ||= project.builds.unscoped.find_by(id: params[:id])
+ @build ||= project.builds.unscoped.find_by!(id: params[:id])
end
def commit_by_sha
diff --git a/app/controllers/ci/commits_controller.rb b/app/controllers/ci/commits_controller.rb
index 887e92f84cf..404e0e4b412 100644
--- a/app/controllers/ci/commits_controller.rb
+++ b/app/controllers/ci/commits_controller.rb
@@ -5,12 +5,6 @@ module Ci
before_action :project
before_action :authorize_access_project!, except: [:status, :show, :cancel]
before_action :authorize_manage_builds!, only: [:cancel]
- before_action :commit, only: :show
- layout 'ci/commit'
-
- def show
- @builds = @commit.builds
- end
def status
commit = Ci::Project.find(params[:project_id]).commits.find_by_sha!(params[:id])