Skip to content

Commit ac1b93a

Browse files
committed
Base the assignment checks on persons rather than email addresses -
otherwise people may use a new email address and not be caught in a check - Legacy-Id: 12264
1 parent 7461409 commit ac1b93a

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

ietf/review/utils.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -681,29 +681,28 @@ def make_assignment_choices(email_queryset, review_req):
681681
# previous review of document
682682
has_reviewed_previous = ReviewRequest.objects.filter(
683683
doc=doc,
684-
reviewer__in=possible_emails,
684+
reviewer__person__in=possible_person_ids,
685685
state="completed",
686686
)
687687

688688
if review_req.pk is not None:
689689
has_reviewed_previous = has_reviewed_previous.exclude(pk=review_req.pk)
690690

691-
has_reviewed_previous = set(has_reviewed_previous.values_list("reviewer", flat=True))
691+
has_reviewed_previous = set(has_reviewed_previous.values_list("reviewer__person", flat=True))
692692

693693
# review wishes
694694
wish_to_review = set(ReviewWish.objects.filter(team=team, person__in=possible_person_ids, doc=doc).values_list("person", flat=True))
695695

696696
# connections
697697
connections = {}
698698
# examine the closest connections last to let them override
699-
for e in Email.objects.filter(pk__in=possible_emails, person=doc.ad_id):
700-
connections[e] = "is associated Area Director"
701-
for r in Role.objects.filter(group=doc.group_id, email__in=possible_emails).select_related("name"):
702-
connections[r.email_id] = "is group {}".format(r.name)
703-
if doc.shepherd_id:
704-
connections[doc.shepherd_id] = "is shepherd of document"
705-
for e in DocumentAuthor.objects.filter(document=doc, author__in=possible_emails).values_list("author", flat=True):
706-
connections[e] = "is author of document"
699+
connections[doc.ad_id] = "is associated Area Director"
700+
for r in Role.objects.filter(group=doc.group_id, person__in=possible_person_ids).select_related("name"):
701+
connections[r.person_id] = "is group {}".format(r.name)
702+
if doc.shepherd:
703+
connections[doc.shepherd.person_id] = "is shepherd of document"
704+
for author in DocumentAuthor.objects.filter(document=doc, author__person__in=possible_person_ids).values_list("author__person", flat=True):
705+
connections[author] = "is author of document"
707706

708707
# unavailable periods
709708
unavailable_periods = current_unavailable_periods_for_reviewers(team)
@@ -724,7 +723,7 @@ def add_boolean_score(direction, expr, explanation=None):
724723

725724
# unavailable for review periods
726725
periods = unavailable_periods.get(e.person_id, [])
727-
unavailable_at_the_moment = periods and not (e.pk in has_reviewed_previous and all(p.availability == "canfinish" for p in periods))
726+
unavailable_at_the_moment = periods and not (e.person_id in has_reviewed_previous and all(p.availability == "canfinish" for p in periods))
728727
add_boolean_score(-1, unavailable_at_the_moment)
729728

730729
def format_period(p):
@@ -738,9 +737,9 @@ def format_period(p):
738737
explanations.append(", ".join(format_period(p) for p in periods))
739738

740739
# misc
741-
add_boolean_score(+1, e.pk in has_reviewed_previous, "reviewed document before")
740+
add_boolean_score(+1, e.person_id in has_reviewed_previous, "reviewed document before")
742741
add_boolean_score(+1, e.person_id in wish_to_review, "wishes to review document")
743-
add_boolean_score(-1, e.pk in connections, connections.get(e.pk)) # reviewer is somehow connected: bad
742+
add_boolean_score(-1, e.person_id in connections, connections.get(e.person_id)) # reviewer is somehow connected: bad
744743
add_boolean_score(-1, settings.filter_re and any(re.search(settings.filter_re, n) for n in aliases), "filter regexp matches")
745744

746745
# minimum interval between reviews

0 commit comments

Comments
 (0)