Skip to content

Commit

Permalink
feat: warn about materials for cancelled sessions (#7959)
Browse files Browse the repository at this point in the history
* feat: warn about materials for cancelled sessions

* fix: handle viewing a DocHistory material object
  • Loading branch information
rjsparks authored Sep 23, 2024
1 parent 25fd4fc commit 06b9df1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,17 @@ def test_document_material(self):

r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
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):
doc = IndividualDraftFactory()
Expand Down
8 changes: 8 additions & 0 deletions ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,13 @@ def document_main(request, name, rev=None, document_html=False):
and doc.group.features.has_nonsession_materials
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",
dict(doc=doc,
top=top,
Expand All @@ -882,6 +889,7 @@ def document_main(request, name, rev=None, document_html=False):
can_upload = can_upload,
other_types=other_types,
presentations=presentations,
session_statusid=session_statusid,
))


Expand Down
3 changes: 3 additions & 0 deletions ietf/templates/doc/document_material.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
</a>
{% endif %}
</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 class="card-header">{{ doc.name }}-{{ doc.rev }}</div>
<div class="card-body{% if content_is_html %} text-break{% endif %}">
Expand Down

0 comments on commit 06b9df1

Please sign in to comment.