diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-31 22:07:06 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-31 22:09:14 +0300 |
commit | 2dcbe3d2d1e9eeefcefd8445cd831f5a007e6c4e (patch) | |
tree | 7ccc8b797ab0eab6b0450b4f5e4871203583c44e /app/serializers | |
parent | a04a9c3857042646e4d380ecc281d3089a76f46c (diff) |
Refactor code climate artifact code on backend
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/merge_request_entity.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/serializers/merge_request_entity.rb b/app/serializers/merge_request_entity.rb index eefda0a960b..7e164548389 100644 --- a/app/serializers/merge_request_entity.rb +++ b/app/serializers/merge_request_entity.rb @@ -197,17 +197,17 @@ class MergeRequestEntity < IssuableEntity end # EE-specific - expose :codeclimate, if: lambda { |mr, _| mr.has_codeclimate_data? && can?(current_user, :read_build, mr.project) } do - expose :head_path do |merge_request| - raw_namespace_project_build_artifacts_url(merge_request.project.namespace, - merge_request.project, - merge_request.codeclimate_artifact, + expose :codeclimate, if: -> (mr, _) { mr.has_codeclimate_data? } do + expose :head_path, if: -> (mr, _) { can?(current_user, :read_build, mr.head_codeclimate_artifact) } do |merge_request| + raw_namespace_project_build_artifacts_url(merge_request.source_project.namespace, + merge_request.source_project, + merge_request.head_codeclimate_artifact, path: 'codeclimate.json') end - expose :base_path do |merge_request| - raw_namespace_project_build_artifacts_url(merge_request.project.namespace, - merge_request.project, + expose :base_path, if: -> (mr, _) { can?(current_user, :read_build, mr.base_codeclimate_artifact) } do |merge_request| + raw_namespace_project_build_artifacts_url(merge_request.target_project.namespace, + merge_request.target_project, merge_request.base_codeclimate_artifact, path: 'codeclimate.json') end |