Commit c7db9929 authored by Matija Čupić's avatar Matija Čupić

Pass current_user to pipeline presenter

parent e55b3da4
...@@ -16,13 +16,13 @@ module EE ...@@ -16,13 +16,13 @@ module EE
end end
end end
expose :codeclimate, if: -> (mr, _) { head_pipeline_downloadable_url_for_report_type(mr, :codequality) } do expose :codeclimate, if: -> (mr, _) { head_pipeline_downloadable_url_for_report_type(:codequality) } do
expose :head_path do |merge_request| expose :head_path do |merge_request|
head_pipeline_downloadable_url_for_report_type(merge_request, :codequality) head_pipeline_downloadable_url_for_report_type(:codequality)
end end
expose :base_path do |merge_request| expose :base_path do |merge_request|
base_pipeline_downloadable_url_for_report_type(merge_request, :codequality) base_pipeline_downloadable_url_for_report_type(:codequality)
end end
end end
...@@ -170,12 +170,12 @@ module EE ...@@ -170,12 +170,12 @@ module EE
private private
def head_pipeline_downloadable_url_for_report_type(merge_request, file_type) def head_pipeline_downloadable_url_for_report_type(file_type)
merge_request.head_pipeline&.present&.downloadable_url_for_report_type(file_type) object.head_pipeline&.present(current_user: current_user)&.downloadable_url_for_report_type(file_type)
end end
def base_pipeline_downloadable_url_for_report_type(merge_request, file_type) def base_pipeline_downloadable_url_for_report_type(file_type)
merge_request.base_pipeline&.present&.downloadable_url_for_report_type(file_type) object.base_pipeline&.present(current_user: current_user)&.downloadable_url_for_report_type(file_type)
end end
end end
end end
...@@ -12,7 +12,7 @@ describe MergeRequestWidgetEntity do ...@@ -12,7 +12,7 @@ describe MergeRequestWidgetEntity do
end end
subject do subject do
described_class.new(merge_request, request: request) described_class.new(merge_request, current_user: user, request: request)
end end
it 'has blob path data' do it 'has blob path data' do
...@@ -32,7 +32,6 @@ describe MergeRequestWidgetEntity do ...@@ -32,7 +32,6 @@ describe MergeRequestWidgetEntity do
base_pipeline: pipeline, base_pipeline: pipeline,
head_pipeline: pipeline head_pipeline: pipeline
) )
allow_any_instance_of(Ci::PipelinePresenter).to receive(:current_user).and_return(user)
end end
context 'with codeclimate data' do context 'with codeclimate data' do
......
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