summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-05-25 02:08:53 +0200
committerMatija Čupić <matteeyah@gmail.com>2019-05-28 17:06:29 +0200
commit1542b160f18b30a8ec28fbdc9c52694b5dfd6f62 (patch)
tree69fc1f1d07def22b22068ceb57f2452a085cf17c /app/serializers
parentc86fa0e45e4a053090b5c17b9678120e39f696a6 (diff)
downloadgitlab-ce-1542b160f18b30a8ec28fbdc9c52694b5dfd6f62.tar.gz
Extract Ci::Build#report_artifacts into methodmc/feature/reports-download
Extracts combining the job_artifacts relation with the with_reports scope for getting report artifacts into a method.
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/build_details_entity.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb
index 6be0a8d1499..67e44ee9d10 100644
--- a/app/serializers/build_details_entity.rb
+++ b/app/serializers/build_details_entity.rb
@@ -42,9 +42,10 @@ class BuildDetailsEntity < JobEntity
end
end
- expose :reports, if: -> (*) { can?(current_user, :read_build, build) }, using: JobArtifactReportEntity do |build|
- build.job_artifacts.with_reports
- end
+ expose :report_artifacts,
+ as: :reports,
+ using: JobArtifactReportEntity,
+ if: -> (*) { can?(current_user, :read_build, build) }
expose :erased_by, if: -> (*) { build.erased? }, using: UserEntity
expose :erase_path, if: -> (*) { build.erasable? && can?(current_user, :erase_build, build) } do |build|