fix: allow ISE to initiate conflict review (#5570)

* ISE may initiate conflict review

Add ISE to list of those roles who can initiate a conflict review.

* fix: improve conditional for conflict review action. Add tests.

* chore: fix comment typo

---------

Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
This commit is contained in:
Eliot Lear 2023-05-03 15:04:09 -04:00 committed by GitHub
parent 6986cae1bf
commit 8af8a91c20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 7 deletions

View file

@ -40,7 +40,7 @@ from ietf.doc.factories import ( DocumentFactory, DocEventFactory, CharterFactor
ConflictReviewFactory, WgDraftFactory, IndividualDraftFactory, WgRfcFactory,
IndividualRfcFactory, StateDocEventFactory, BallotPositionDocEventFactory,
BallotDocEventFactory, DocumentAuthorFactory, NewRevisionDocEventFactory,
StatusChangeFactory, BofreqFactory, DocExtResourceFactory)
StatusChangeFactory, BofreqFactory, DocExtResourceFactory, RgDraftFactory)
from ietf.doc.forms import NotifyForm
from ietf.doc.fields import SearchableDocumentsField
from ietf.doc.utils import create_ballot_if_not_open, uppercase_std_abbreviated_name
@ -2819,3 +2819,45 @@ class NotifyValidationTests(TestCase):
self.assertFalse(f.is_valid())
self.assertTrue("Invalid addresses" in f.errors["notify"][0])
self.assertTrue("Duplicate addresses" in f.errors["notify"][0])
class CanRequestConflictReviewTests(TestCase):
def test_gets_request_conflict_review_action_button(self):
ise_draft = IndividualDraftFactory(stream_id="ise")
irtf_draft = RgDraftFactory()
# This is blunt, trading off precision for time. A more thorough test would ensure
# that the text is in a button and that the correct link is absent/present as well.
target_string = "Begin IETF conflict review"
url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=irtf_draft.name))
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.login(username="secretary", password="secretary+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="irtf-chair", password="irtf-chair+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="ise-chair", password="ise-chair+password")
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.logout()
url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=ise_draft.name))
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.login(username="secretary", password="secretary+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="irtf-chair", password="irtf-chair+password")
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.logout()
self.client.login(username="ise-chair", password="ise-chair+password")
r = self.client.get(url)
self.assertContains(r, target_string)

View file

@ -427,12 +427,20 @@ def document_main(request, name, rev=None, document_html=False):
urlreverse('ietf.doc.views_ballot.close_rsab_ballot', kwargs=dict(name=doc.name))
))
if (doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("ise", "irtf")
and has_role(request.user, ("Secretariat", "IRTF Chair")) and not conflict_reviews and not snapshot):
label = "Begin IETF Conflict Review"
if not doc.intended_std_level:
label += " (note that intended status is not set)"
actions.append((label, urlreverse('ietf.doc.views_conflict_review.start_review', kwargs=dict(name=doc.name))))
if (
doc.get_state_slug() not in ["rfc", "expired"]
and not conflict_reviews
and not snapshot
):
if (
doc.stream_id == "ise" and has_role(request.user, ("Secretariat", "ISE"))
) or (
doc.stream_id == "irtf" and has_role(request.user, ("Secretariat", "IRTF Chair"))
):
label = "Begin IETF conflict review" # Note that the template feeds this through capfirst_allcaps
if not doc.intended_std_level:
label += " (note that intended status is not set)"
actions.append((label, urlreverse('ietf.doc.views_conflict_review.start_review', kwargs=dict(name=doc.name))))
if doc.get_state_slug() not in ["rfc", "expired"] and not snapshot:
if can_request_rfc_publication(request.user, doc):