feat: warn about materials for cancelled sessions (#7959)
* feat: warn about materials for cancelled sessions * fix: handle viewing a DocHistory material object
This commit is contained in:
parent
25fd4fce5d
commit
06b9df10ee
|
@ -1683,6 +1683,17 @@ class DocTestCase(TestCase):
|
||||||
|
|
||||||
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
|
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
self.assertNotContains(r, "The session for this document was cancelled.")
|
||||||
|
|
||||||
|
SchedulingEvent.objects.create(
|
||||||
|
session=session,
|
||||||
|
status_id='canceled',
|
||||||
|
by = Person.objects.get(user__username="marschairman"),
|
||||||
|
)
|
||||||
|
|
||||||
|
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
|
||||||
|
self.assertEqual(r.status_code, 200)
|
||||||
|
self.assertContains(r, "The session for this document was cancelled.")
|
||||||
|
|
||||||
def test_document_ballot(self):
|
def test_document_ballot(self):
|
||||||
doc = IndividualDraftFactory()
|
doc = IndividualDraftFactory()
|
||||||
|
|
|
@ -870,6 +870,13 @@ def document_main(request, name, rev=None, document_html=False):
|
||||||
and doc.group.features.has_nonsession_materials
|
and doc.group.features.has_nonsession_materials
|
||||||
and doc.type_id in doc.group.features.material_types
|
and doc.type_id in doc.group.features.material_types
|
||||||
)
|
)
|
||||||
|
|
||||||
|
session_statusid = None
|
||||||
|
actual_doc = doc if isinstance(doc,Document) else doc.doc
|
||||||
|
if actual_doc.session_set.count() == 1:
|
||||||
|
if actual_doc.session_set.get().schedulingevent_set.exists():
|
||||||
|
session_statusid = actual_doc.session_set.get().schedulingevent_set.order_by("-time").first().status_id
|
||||||
|
|
||||||
return render(request, "doc/document_material.html",
|
return render(request, "doc/document_material.html",
|
||||||
dict(doc=doc,
|
dict(doc=doc,
|
||||||
top=top,
|
top=top,
|
||||||
|
@ -882,6 +889,7 @@ def document_main(request, name, rev=None, document_html=False):
|
||||||
can_upload = can_upload,
|
can_upload = can_upload,
|
||||||
other_types=other_types,
|
other_types=other_types,
|
||||||
presentations=presentations,
|
presentations=presentations,
|
||||||
|
session_statusid=session_statusid,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,9 @@
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
{% if session_statusid == "canceled" %}
|
||||||
|
<div class="alert alert-warning">The session for this document was cancelled.</div>
|
||||||
|
{% endif %}
|
||||||
<div id="materials-content" class="card mt-5">
|
<div id="materials-content" class="card mt-5">
|
||||||
<div class="card-header">{{ doc.name }}-{{ doc.rev }}</div>
|
<div class="card-header">{{ doc.name }}-{{ doc.rev }}</div>
|
||||||
<div class="card-body{% if content_is_html %} text-break{% endif %}">
|
<div class="card-body{% if content_is_html %} text-break{% endif %}">
|
||||||
|
|
Loading…
Reference in a new issue