Commit e9a3f7fe authored by Mark Chao's avatar Mark Chao

Skip analysis if no approvals required

parent d1e96959
......@@ -40,14 +40,7 @@ class MergeRequestApproverPresenter < Gitlab::View::Presenter::Simple
private
def users
return @users if defined?(@users)
load_users
@users
end
def load_users
set_users_from_git_log_authors
@users ||= users_from_git_log_authors
end
def code_owner_enabled?
......@@ -56,8 +49,12 @@ class MergeRequestApproverPresenter < Gitlab::View::Presenter::Simple
end
end
def set_users_from_git_log_authors
@users = ::Gitlab::AuthorityAnalyzer.new(merge_request, skip_user).calculate.first(merge_request.approvals_required)
def users_from_git_log_authors
if merge_request.approvals_required > 0
::Gitlab::AuthorityAnalyzer.new(merge_request, skip_user).calculate.first(merge_request.approvals_required)
else
[]
end
end
def code_owner_loader
......
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