BigW Consortium Gitlab

Commit 9e0e9342 by Grzegorz Bizon

Rename method that returns url to CI build artifacts download

parent 612ab584
......@@ -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
......
......@@ -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
......@@ -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?
......
......@@ -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
......
......@@ -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?
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment