diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-22 00:30:37 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-06 18:46:00 +0200 |
commit | 6776fac62200e6ec558dc6cc2cde120b82fce5da (patch) | |
tree | 8eec821e1ad954aabf4cb7af0287ac627b83673a /app/presenters | |
parent | 927a9b13f083b7610d7ab31fa4204c1991668ddb (diff) | |
download | gitlab-ce-6776fac62200e6ec558dc6cc2cde120b82fce5da.tar.gz |
Respect permissions when showing Failed Jobs
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/ci/pipeline_presenter.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 099b4720fb6..cc2bce9862d 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -1,11 +1,21 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated + include Gitlab::Utils::StrongMemoize + FAILURE_REASONS = { config_error: 'CI/CD YAML configuration error!' }.freeze presents :pipeline + def failed_builds + return [] unless can?(current_user, :read_build, pipeline) + + strong_memoize(:failed_builds) do + pipeline.builds.latest.failed + end + end + def failure_reason return unless pipeline.failure_reason? |