From 6fe7ff89563eeb45cf98deb54724428ecc4c6cb9 Mon Sep 17 00:00:00 2001
From: Robert Sparks
Date: Fri, 20 Sep 2024 16:24:56 -0500
Subject: [PATCH 1/2] feat: warn about materials for cancelled sessions
---
ietf/doc/tests.py | 11 +++++++++++
ietf/doc/views_doc.py | 7 +++++++
ietf/templates/doc/document_material.html | 3 +++
3 files changed, 21 insertions(+)
diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py
index 5e5b741fe51..f5f715162d0 100644
--- a/ietf/doc/tests.py
+++ b/ietf/doc/tests.py
@@ -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()
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
index d12dd04181e..62ee4315e2b 100644
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -870,6 +870,12 @@ 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
+ if doc.session_set.count() == 1:
+ if doc.session_set.get().schedulingevent_set.exists():
+ session_statusid = doc.session_set.get().schedulingevent_set.order_by("-time").first().status_id
+
return render(request, "doc/document_material.html",
dict(doc=doc,
top=top,
@@ -882,6 +888,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,
))
diff --git a/ietf/templates/doc/document_material.html b/ietf/templates/doc/document_material.html
index 7537082df9f..cf6dd1ab647 100644
--- a/ietf/templates/doc/document_material.html
+++ b/ietf/templates/doc/document_material.html
@@ -153,6 +153,9 @@
{% endif %}
+ {% if session_statusid == "canceled" %}
+ The session for this document was cancelled.
+ {% endif %}
From fcf465862eb0089e8870e59eb4137bb4a64e491a Mon Sep 17 00:00:00 2001
From: Robert Sparks
Date: Mon, 23 Sep 2024 09:46:46 -0500
Subject: [PATCH 2/2] fix: handle viewing a DocHistory material object
---
ietf/doc/views_doc.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
index 62ee4315e2b..aad45920c6d 100644
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -872,9 +872,10 @@ def document_main(request, name, rev=None, document_html=False):
)
session_statusid = None
- if doc.session_set.count() == 1:
- if doc.session_set.get().schedulingevent_set.exists():
- session_statusid = doc.session_set.get().schedulingevent_set.order_by("-time").first().status_id
+ 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,