diff options
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/commit_status.rb | 6 | ||||
-rw-r--r-- | app/views/admin/builds/_build.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/builds/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/commit_statuses/_commit_status.html.haml | 4 | ||||
-rw-r--r-- | spec/models/build_spec.rb | 4 |
6 files changed, 14 insertions, 10 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index e576f94fd4e..9adbfdd2c92 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -319,7 +319,7 @@ module Ci pending? && !any_runners_online? end - def download_url + def artifacts_download_url if artifacts_file.exists? download_namespace_project_build_artifacts_path(project.namespace, project, self) end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index ff479493474..4ce9b998dfc 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -131,7 +131,11 @@ class CommitStatus < ActiveRecord::Base false end - def download_url + def artifacts_download_url + nil + end + + def artifacts_browse_url nil end end diff --git a/app/views/admin/builds/_build.html.haml b/app/views/admin/builds/_build.html.haml index 6936e614346..7cd98c0f540 100644 --- a/app/views/admin/builds/_build.html.haml +++ b/app/views/admin/builds/_build.html.haml @@ -60,8 +60,8 @@ %td .pull-right - - if current_user && can?(current_user, :download_build_artifacts, project) && build.download_url - = link_to build.download_url, title: 'Download artifacts' do + - if current_user && can?(current_user, :download_build_artifacts, project) && build.artifacts_file.exist? + = link_to build.artifacts_download_url, title: 'Download artifacts' do %i.fa.fa-download - if current_user && can?(current_user, :manage_builds, build.project) - if build.active? diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 937ee293bc8..5780d7ad175 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -89,13 +89,13 @@ Test coverage %h1 #{@build.coverage}% - - if current_user && can?(current_user, :download_build_artifacts, @project) && @build.download_url + - if current_user && can?(current_user, :download_build_artifacts, @project) && @build.artifacts_file.exist? .build-widget.center .panel.panel-default .panel-heading Build artifacts .panel-body .btn-group{ role: :group } - = link_to "Download", @build.download_url, class: 'btn btn-sm btn-primary' + = link_to "Download", @build.artifacts_download_url, class: 'btn btn-sm btn-primary' = link_to "Browse", @build.artifacts_browse_url, class: 'btn btn-sm btn-primary' .build-widget diff --git a/app/views/projects/commit_statuses/_commit_status.html.haml b/app/views/projects/commit_statuses/_commit_status.html.haml index 74a05df24d3..5e7f55fdbff 100644 --- a/app/views/projects/commit_statuses/_commit_status.html.haml +++ b/app/views/projects/commit_statuses/_commit_status.html.haml @@ -66,8 +66,8 @@ %td .pull-right - - if current_user && can?(current_user, :download_build_artifacts, commit_status.project) && commit_status.download_url - = link_to commit_status.download_url, title: 'Download artifacts' do + - if current_user && can?(current_user, :download_build_artifacts, commit_status.project) && commit_status.artifacts_file.exist? + = link_to commit_status.artifacts_download_url, title: 'Download artifacts' do %i.fa.fa-download - if current_user && can?(current_user, :manage_builds, commit_status.project) - if commit_status.active? diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 1c22e3cb7c4..85cba9c3e57 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -368,8 +368,8 @@ describe Ci::Build, models: true do end end - describe :download_url do - subject { build.download_url } + describe :artifacts_download_url do + subject { build.artifacts_download_url } it "should be nil if artifact doesn't exist" do build.update_attributes(artifacts_file: nil) |