Commit d875a710 authored by Albert Salim's avatar Albert Salim

Exclude trainee maintainer from `#reviewer?`

Since there is `#trainee_maintainer?`, we should get
trainee_maintainer purely using `#trainee_maintainer?` to avoid
confusion such as https://gitlab.com/gitlab-com/www-gitlab-com/-/issues/9119
parent 72c49f29
......@@ -147,6 +147,7 @@ module Gitlab
spin_role_for_category(team, role, project, category)
end
hungry_reviewers = reviewers.select { |member| member.hungry }
hungry_traintainers = traintainers.select { |member| member.hungry }
# TODO: take CODEOWNERS into account?
# https://gitlab.com/gitlab-org/gitlab/issues/26723
......@@ -156,7 +157,7 @@ module Gitlab
# Make hungry traintainers have 4x the chance to be picked as a reviewer
# Make traintainers have 3x the chance to be picked as a reviewer
# Make hungry reviewers have 2x the chance to be picked as a reviewer
weighted_reviewers = reviewers + hungry_reviewers + traintainers + traintainers
weighted_reviewers = reviewers + hungry_reviewers + traintainers + traintainers + traintainers + hungry_traintainers
reviewer = spin_for_person(weighted_reviewers, random: random, timezone_experiment: timezone_experiment)
maintainer = spin_for_person(maintainers, random: random, timezone_experiment: timezone_experiment)
......
......@@ -32,10 +32,8 @@ module Gitlab
projects&.has_key?(name)
end
# Traintainers also count as reviewers
def reviewer?(project, category, labels)
has_capability?(project, category, :reviewer, labels) ||
traintainer?(project, category, labels)
has_capability?(project, category, :reviewer, labels)
end
def traintainer?(project, category, labels)
......
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