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
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-01-17 18:56:27 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-01-17 18:56:27 +0300
commitfbc1a06c75054cc02c7834d2391d7ec194ab0b4d (patch)
tree555a1f8ba458c41af5973cc7356fbf5b68782479 /app
parente324ccc20c52d492dd660097a4c72615c5621917 (diff)
parent4657c28777dfc2729261f895f8e36cbef51395bc (diff)
Merge branch 'fix/keep-artifacts-button-visibility' into 'master'
Do not show artifacts keep button if not allowed Closes #26357 See merge request !8501
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/views/projects/builds/_sidebar.html.haml4
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 27042798741..48ffe40abc6 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -507,6 +507,10 @@ module Ci
end
end
+ def has_expiring_artifacts?
+ artifacts_expire_at.present?
+ end
+
def keep_artifacts!
self.update(artifacts_expire_at: nil)
end
diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml
index 0b3adcbe121..37bf085130a 100644
--- a/app/views/projects/builds/_sidebar.html.haml
+++ b/app/views/projects/builds/_sidebar.html.haml
@@ -22,14 +22,14 @@
%p.build-detail-row
The artifacts were removed
#{time_ago_with_tooltip(@build.artifacts_expire_at)}
- - elsif @build.artifacts_expire_at
+ - elsif @build.has_expiring_artifacts?
%p.build-detail-row
The artifacts will be removed in
%span.js-artifacts-remove= @build.artifacts_expire_at
- if @build.artifacts?
.btn-group.btn-group-justified{ role: :group }
- - if @build.artifacts_expire_at
+ - if @build.has_expiring_artifacts? && can?(current_user, :update_build, @build)
= link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do
Keep