Commit 59ff00cb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix rubocop issues in app/serializers/merge_request_entity.rb

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent f6e182cb
...@@ -202,9 +202,7 @@ class MergeRequestEntity < IssuableEntity ...@@ -202,9 +202,7 @@ class MergeRequestEntity < IssuableEntity
end end
end end
expose :sast_path, if: -> (mr, _) { mr.project.feature_available?(:sast) && expose :sast_path, if: expose_sast_data(mr, current_user) do |merge_request|
mr.has_sast_data? &&
can?(current_user, :read_build, mr.sast_artifact) } do |merge_request|
raw_project_build_artifacts_url(merge_request.source_project, raw_project_build_artifacts_url(merge_request.source_project,
merge_request.sast_artifact, merge_request.sast_artifact,
path: 'gl-sast-report.json') path: 'gl-sast-report.json')
...@@ -218,4 +216,10 @@ class MergeRequestEntity < IssuableEntity ...@@ -218,4 +216,10 @@ class MergeRequestEntity < IssuableEntity
@presenters ||= {} @presenters ||= {}
@presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: current_user) @presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: current_user)
end end
def expose_sast_data?(mr, current_user)
mr.project.feature_available?(:sast) &&
mr.has_sast_data? &&
can?(current_user, :read_build, mr.sast_artifact)
end
end end
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