Commit 0a5bce6e authored by Can Eldem's avatar Can Eldem Committed by Rémy Coutable

Backport changes for 16252 in EE add current_user to report comparison services

parent f95857c8
......@@ -1239,7 +1239,7 @@ class MergeRequest < ApplicationRecord
end
def compare_reports(service_class, current_user = nil)
with_reactive_cache(service_class.name) do |data|
with_reactive_cache(service_class.name, current_user&.id) do |data|
unless service_class.new(project, current_user)
.latest?(base_pipeline, actual_head_pipeline, data)
raise InvalidateReactiveCache
......@@ -1249,12 +1249,13 @@ class MergeRequest < ApplicationRecord
end || { status: :parsing }
end
def calculate_reactive_cache(identifier, *args)
def calculate_reactive_cache(identifier, current_user_id = nil, *args)
service_class = identifier.constantize
raise NameError, service_class unless service_class < Ci::CompareReportsBaseService
service_class.new(project).execute(base_pipeline, actual_head_pipeline)
current_user = User.find_by(id: current_user_id)
service_class.new(project, current_user).execute(base_pipeline, actual_head_pipeline)
end
def all_commits
......
......@@ -41,7 +41,7 @@ module Ci
end
def serializer_params
{ project: project }
{ project: project, current_user: current_user }
end
def get_report(pipeline)
......
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