Skip to content

Commit 06b9df1

Browse files
authored
feat: warn about materials for cancelled sessions (ietf-tools#7959)
* feat: warn about materials for cancelled sessions * fix: handle viewing a DocHistory material object
1 parent 25fd4fc commit 06b9df1

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

ietf/doc/tests.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,17 @@ def test_document_material(self):
16831683

16841684
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
16851685
self.assertEqual(r.status_code, 200)
1686+
self.assertNotContains(r, "The session for this document was cancelled.")
1687+
1688+
SchedulingEvent.objects.create(
1689+
session=session,
1690+
status_id='canceled',
1691+
by = Person.objects.get(user__username="marschairman"),
1692+
)
1693+
1694+
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
1695+
self.assertEqual(r.status_code, 200)
1696+
self.assertContains(r, "The session for this document was cancelled.")
16861697

16871698
def test_document_ballot(self):
16881699
doc = IndividualDraftFactory()

ietf/doc/views_doc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,13 @@ def document_main(request, name, rev=None, document_html=False):
870870
and doc.group.features.has_nonsession_materials
871871
and doc.type_id in doc.group.features.material_types
872872
)
873+
874+
session_statusid = None
875+
actual_doc = doc if isinstance(doc,Document) else doc.doc
876+
if actual_doc.session_set.count() == 1:
877+
if actual_doc.session_set.get().schedulingevent_set.exists():
878+
session_statusid = actual_doc.session_set.get().schedulingevent_set.order_by("-time").first().status_id
879+
873880
return render(request, "doc/document_material.html",
874881
dict(doc=doc,
875882
top=top,
@@ -882,6 +889,7 @@ def document_main(request, name, rev=None, document_html=False):
882889
can_upload = can_upload,
883890
other_types=other_types,
884891
presentations=presentations,
892+
session_statusid=session_statusid,
885893
))
886894

887895

ietf/templates/doc/document_material.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
</a>
154154
{% endif %}
155155
</p>
156+
{% if session_statusid == "canceled" %}
157+
<div class="alert alert-warning">The session for this document was cancelled.</div>
158+
{% endif %}
156159
<div id="materials-content" class="card mt-5">
157160
<div class="card-header">{{ doc.name }}-{{ doc.rev }}</div>
158161
<div class="card-body{% if content_is_html %} text-break{% endif %}">

0 commit comments

Comments
 (0)