Skip to content

Commit

Permalink
fix: Server error from api_get_session_materials()
Browse files Browse the repository at this point in the history
when session has no agenda
  • Loading branch information
nectostr committed Jul 22, 2023
1 parent c717673 commit 54ba9f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions ietf/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,15 @@ def test_api_appauth(self):
self.assertEqual(r.status_code, 200)
jsondata = r.json()
self.assertEqual(jsondata['success'], True)

def test_api_get_session_matherials_no_agenda_meeting_url(self):
meeting = MeetingFactory(type_id='ietf')
session = SessionFactory(meeting=meeting)
url = urlreverse('ietf.meeting.views.api_get_session_materials', kwargs={'session_id': session.pk})
r = self.client.get(url)
self.assertEqual(r.status_code, 200)



class DirectAuthApiTests(TestCase):

Expand Down
6 changes: 4 additions & 2 deletions ietf/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,9 +1704,11 @@ def api_get_session_materials (request, session_id=None):
})
else:
pass # no action available if it's past cutoff


agenda = session.agenda()
agenda_url = agenda.get_href() if agenda is not None else None
return JsonResponse({
"url": session.agenda().get_href(),
"url": agenda_url,
"slides": {
"decks": list(map(agenda_extract_slide, session.slides())),
"actions": slides_actions,
Expand Down

0 comments on commit 54ba9f6

Please sign in to comment.