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

Pass current_user to pipeline presenter

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