Merged in [16785] from rjsparks@nostrum.com:
Improve alerts when looking at non-current versions of a charter document. Fixes #2774. - Legacy-Id: 16845 Note: SVN reference [16785] has been migrated to Git commit 07637c27e1a76d3cbb92cc22b987b9f1426d8d52
This commit is contained in:
parent
b7c5e93e44
commit
5460a5ab84
|
@ -528,3 +528,12 @@ def rfcbis(s):
|
|||
def urlize(value):
|
||||
raise RuntimeError("Use linkify from textfilters instead of urlize")
|
||||
|
||||
@register.filter
|
||||
@stringfilter
|
||||
def charter_major_rev(rev):
|
||||
return rev[:2]
|
||||
|
||||
@register.filter
|
||||
@stringfilter
|
||||
def charter_minor_rev(rev):
|
||||
return rev[3:5]
|
||||
|
|
|
@ -16,7 +16,7 @@ from django.urls import reverse as urlreverse
|
|||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.doc.factories import CharterFactory
|
||||
from ietf.doc.factories import CharterFactory, NewRevisionDocEventFactory
|
||||
from ietf.doc.models import ( Document, State, BallotDocEvent, BallotType, NewRevisionDocEvent,
|
||||
TelechatDocEvent, WriteupDocEvent )
|
||||
from ietf.doc.utils_charter import ( next_revision, default_review_text, default_action_text,
|
||||
|
@ -30,6 +30,61 @@ from ietf.utils.test_utils import TestCase
|
|||
from ietf.utils.mail import outbox, empty_outbox, get_payload
|
||||
from ietf.utils.test_utils import login_testing_unauthorized
|
||||
|
||||
class ViewCharterTests(TestCase):
|
||||
def test_view_revisions(self):
|
||||
charter = CharterFactory()
|
||||
e = NewRevisionDocEventFactory(doc=charter,rev="01")
|
||||
charter.rev = e.rev
|
||||
charter.save_with_history([e])
|
||||
e = NewRevisionDocEventFactory(doc=charter,rev="01-00")
|
||||
charter.rev = e.rev
|
||||
charter.save_with_history([e])
|
||||
e =NewRevisionDocEventFactory(doc=charter,rev="02")
|
||||
charter.rev = e.rev
|
||||
charter.save_with_history([e])
|
||||
e =NewRevisionDocEventFactory(doc=charter,rev="02-00")
|
||||
charter.rev = e.rev
|
||||
charter.save_with_history([e])
|
||||
e = NewRevisionDocEventFactory(doc=charter,rev="02-01")
|
||||
charter.rev = e.rev
|
||||
charter.save_with_history([e])
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertIn('The information below is for a proposed recharter. The current approved charter is',q('#message-row').text())
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'02-00'})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertIn('The information below is for an older version of the current proposed rechartering effort',q('#message-row').text())
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'02'})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertIn('The information below is for the currently approved charter, but newer proposed charter text exists',q('#message-row').text())
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'01-00'})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertIn('The information below is for an older proposed',q('#message-row').text())
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name,'rev':'01'})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertIn('The information below is for an older approved',q('#message-row').text())
|
||||
|
||||
e = NewRevisionDocEventFactory(doc=charter,rev="03")
|
||||
charter.rev='03'
|
||||
charter.save_with_history([e])
|
||||
|
||||
url = urlreverse('ietf.doc.views_doc.document_main',kwargs={'name':charter.name})
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual('',q('#message-row').text())
|
||||
|
||||
|
||||
|
||||
class EditCharterTests(TestCase):
|
||||
def setUp(self):
|
||||
self.charter_dir = self.tempdir('charter')
|
||||
|
|
|
@ -23,11 +23,23 @@
|
|||
<table class="table table-condensed">
|
||||
<thead id="message-row">
|
||||
<tr>
|
||||
{% if doc.rev != latest_rev %}
|
||||
<th colspan="4" class="alert-warning">The information below is for an old version of the document</th>
|
||||
{% else %}
|
||||
<th colspan="4"></th>
|
||||
{% endif %}
|
||||
{% if doc.rev|charter_major_rev != latest_rev|charter_major_rev %}
|
||||
<th colspan="4" class="alert-warning">The information below is for an older {% if doc.rev|charter_minor_rev %}proposed{% else %}approved{% endif %} charter</th>
|
||||
{% else %}
|
||||
{% if doc.rev != latest_rev %}
|
||||
{% if doc.rev|charter_minor_rev %}
|
||||
<th colspan="4" class="alert-warning">The information below is for an older version of the current proposed rechartering effort</th>
|
||||
{% else %}
|
||||
<th colspan="4" class="alert-info">The information below is for the currently approved charter, but newer proposed charter text exists</th>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if doc.rev|charter_minor_rev and doc.rev|charter_major_rev != '00' %}
|
||||
<th colspan="4" class="alert-info">The information below is for a proposed recharter. The current approved charter is version {{ doc.rev|charter_major_rev }}</th>
|
||||
{% else %}
|
||||
<th colspan="4"></th>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
|
Loading…
Reference in a new issue