diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/serializers/build_artifact_entity.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/serializers/build_artifact_entity.rb')
-rw-r--r-- | app/serializers/build_artifact_entity.rb | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/app/serializers/build_artifact_entity.rb b/app/serializers/build_artifact_entity.rb index fac0fbd14b9..7a030372591 100644 --- a/app/serializers/build_artifact_entity.rb +++ b/app/serializers/build_artifact_entity.rb @@ -4,30 +4,28 @@ class BuildArtifactEntity < Grape::Entity include RequestAwareEntity include GitlabRoutingHelper - expose :name do |job| - job.name - end - - expose :artifacts_expired?, as: :expired - expose :artifacts_expire_at, as: :expire_at + alias_method :artifact, :object - expose :path do |job| - fast_download_project_job_artifacts_path(project, job) + expose :name do |artifact| + "#{artifact.job.name}:#{artifact.file_type}" end - expose :keep_path, if: -> (*) { job.has_expiring_archive_artifacts? } do |job| - fast_keep_project_job_artifacts_path(project, job) - end + expose :expire_at + expose :expired?, as: :expired - expose :browse_path do |job| - fast_browse_project_job_artifacts_path(project, job) + expose :path do |artifact| + fast_download_project_job_artifacts_path( + artifact.project, + artifact.job, + file_type: artifact.file_type + ) end - private - - alias_method :job, :object + expose :keep_path, if: -> (*) { artifact.expiring? } do |artifact| + fast_keep_project_job_artifacts_path(artifact.project, artifact.job) + end - def project - job.project + expose :browse_path do |artifact| + fast_browse_project_job_artifacts_path(artifact.project, artifact.job) end end |