Repository: ietf-tools/datatracker

Issue:
agenda-neue - Show agenda materials doesn't show slides
### Describe the issue

Slides are missing from the "Show agenda materials" dialog on agenda-neue

<img width="858" alt="image" src="https://user-images.githubusercontent.com/15522395/180838353-d9f89057-744c-403d-b48b-be904d833fb0.png">


### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Resolving patch:
diff --git a/ietf/api/urls.py b/ietf/api/urls.py
--- a/ietf/api/urls.py
+++ b/ietf/api/urls.py
@@ -29,6 +29,8 @@
     url(r'^meeting/session/video/url$', meeting_views.api_set_session_video_url),
     # Meeting agenda + floorplan data
     url(r'^meeting/(?P<num>[A-Za-z0-9._+-]+)/agenda-data$', meeting_views.api_get_agenda_data),
+    # Meeting session materials
+    url(r'^meeting/session/(?P<session_id>[A-Za-z0-9._+-]+)/materials$', meeting_views.api_get_session_materials),
     # Let Meetecho trigger recording imports
     url(r'^notify/meeting/import_recordings/(?P<number>[a-z0-9-]+)/?$', meeting_views.api_import_recordings),
     # Let MeetEcho upload bluesheets
diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py
--- a/ietf/meeting/views.py
+++ b/ietf/meeting/views.py
@@ -1639,9 +1639,26 @@ def api_get_agenda_data (request, num=None):
         "floors": list(map(agenda_extract_floorplan, floors))
     })
 
+def api_get_session_materials (request, session_id=None):
+    session = get_object_or_404(Session,pk=session_id)
+
+    minutes = session.minutes()
+
+    return JsonResponse({
+        "url": session.agenda().get_href(),
+        "slides": list(map(agenda_extract_slide, session.slides())),
+        "minutes": {
+            "id": minutes.id,
+            "title": minutes.title,
+            "url": minutes.get_href(),
+            "ext": minutes.file_extension()
+        } if minutes is not None else None
+    })
+
 def agenda_extract_schedule (item):
     return {
         "id": item.id,
+        "sessionId": item.session.id,
         "room": item.room_name,
         "location": {
             "short": item.timeslot.location.floorplan.short,
@@ -1727,6 +1744,14 @@ def agenda_extract_recording (item):
         "url": item.external_url
     }
 
+def agenda_extract_slide (item):
+    return {
+        "id": item.id,
+        "title": item.title,
+        "url": item.get_versionless_href(),
+        "ext": item.file_extension()
+    }
+
 def agenda_csv(schedule, filtered_assignments):
     response = HttpResponse(content_type="text/csv; charset=%s"%settings.DEFAULT_CHARSET)
     writer = csv.writer(response, delimiter=str(','), quoting=csv.QUOTE_ALL)


Test patch:
diff --git a/ietf/meeting/tests_views.py b/ietf/meeting/tests_views.py
--- a/ietf/meeting/tests_views.py
+++ b/ietf/meeting/tests_views.py
@@ -170,6 +170,7 @@ def test_meeting_agenda(self):
         self.assertEqual(r.status_code, 200)  
 
         # Agenda API tests
+        # -> Meeting data
         r = self.client.get(urlreverse("ietf.meeting.views.api_get_agenda_data", kwargs=dict(num=meeting.number)))
         self.assertEqual(r.status_code, 200)  
         rjson = json.loads(r.content.decode("utf8"))
@@ -193,6 +194,24 @@ def test_meeting_agenda(self):
                 "floors": []
             }
         )
+        # -> Session Materials
+        r = self.client.get(urlreverse("ietf.meeting.views.api_get_session_materials", kwargs=dict(session_id=session.id)))
+        self.assertEqual(r.status_code, 200)  
+        rjson = json.loads(r.content.decode("utf8"))
+        minutes = session.minutes()
+        self.assertJSONEqual(
+            r.content.decode("utf8"),
+            {
+                "url": session.agenda().get_href(),
+                "slides": rjson.get("slides"), # Just expect the value to exist
+                "minutes": {
+                    "id": minutes.id,
+                    "title": minutes.title,
+                    "url": minutes.get_href(),
+                    "ext": minutes.file_extension()
+                } if minutes is not None else None
+            }
+        )
 
         r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number,utc='-utc')))
         self.assertEqual(r.status_code, 200)