Commit 584a2761 authored by Alexander Færøy's avatar Alexander Færøy 🍍
Browse files

Merge branch 'ignore-busy' into 'main'

don't assign busy people as reviewer

Closes #1

See merge request tpo/tpa/triage-ops!7
parents 77020b66 a0f4f3e9
......@@ -13,7 +13,15 @@ module TorPlugin
# Returns a random reviewer found in the reviewers argument, but exclude the
# author of the MR.
def random_reviewer(reviewers)
random_sample(reviewers, [author[:username]])
random_sample( {|reviewer| !busy(reviewer) }, [author[:username]])
# Returns whether user is currently busy
def busy(user)
url = build_url(options: { source: 'users',
source_id: user,
resource_type: 'status'})
network.query_api_cached(url)[0][:availability] == "busy"
# Returns the author of a given issue or MR.
Supports Markdown
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