Skip to content

Commit 5348aef

Browse files
authored
feat: show existing recordings on materials page (ietf-tools#8102)
* feat: show existing recordings on materials page * chore: notes and recordings tests WIP * chore: test session recordings * feat: label all session recording urls as meetecho
1 parent afbe6aa commit 5348aef

2 files changed

Lines changed: 77 additions & 44 deletions

File tree

ietf/meeting/tests_views.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,40 @@ def test_meeting_agenda(self):
407407
r = self.client.get(urlreverse('floor-plan', kwargs=dict(num=meeting.number)))
408408
self.assertEqual(r.status_code, 200)
409409

410+
def test_session_recordings_via_factories(self):
411+
session = SessionFactory(meeting__type_id="ietf")
412+
self.assertEqual(session.meetecho_recording_name, "")
413+
self.assertEqual(len(session.recordings()), 0)
414+
url = urlreverse("ietf.meeting.views.session_details", kwargs=dict(num=session.meeting.number, acronym=session.group.acronym))
415+
r = self.client.get(url)
416+
q = PyQuery(r.content)
417+
# debug.show("q('#notes_and_recordings_1')")
418+
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 1)
419+
link = q("#notes_and_recordings_1 tr a")
420+
self.assertEqual(len(link), 1)
421+
self.assertEqual(link[0].attrib['href'], str(session.session_recording_url()))
422+
423+
session.meetecho_recording_name = 'my_test_session_name'
424+
session.save()
425+
r = self.client.get(url)
426+
q = PyQuery(r.content)
427+
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 1)
428+
links = q("#notes_and_recordings_1 tr a")
429+
self.assertEqual(len(links), 1)
430+
self.assertEqual(links[0].attrib['href'], session.session_recording_url())
431+
432+
new_recording_url = "https://www.youtube.com/watch?v=jNQXAC9IVRw"
433+
new_recording_title = "Me at the zoo"
434+
create_recording(session, new_recording_url, new_recording_title)
435+
r = self.client.get(url)
436+
q = PyQuery(r.content)
437+
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 2)
438+
links = q("#notes_and_recordings_1 tr a")
439+
self.assertEqual(len(links), 2)
440+
self.assertEqual(links[0].attrib['href'], new_recording_url)
441+
self.assertIn(new_recording_title, links[0].text_content())
442+
#debug.show("q('#notes_and_recordings_1')")
443+
410444
def test_agenda_ical_next_meeting_type(self):
411445
# start with no upcoming IETF meetings, just an interim
412446
MeetingFactory(

ietf/templates/meeting/session_details_panel.html

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -320,51 +320,50 @@ <h3 class="mt-4">Notes and recordings</h3>
320320
</tr>
321321
{% endif %}
322322
{# Recordings #}
323-
{% if session.has_recordings %}
324-
{% with session.recordings as recordings %}
325-
{% if recordings %}
326-
{# There's no guaranteed order, so this is a bit messy: #}
327-
{# First, the audio recordings, if any #}
328-
{% for r in recordings %}
329-
{% if r.get_href and 'audio' in r.get_href %}
330-
<tr>
331-
<td>
332-
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
333-
</td>
334-
</tr>
335-
{% endif %}
336-
{% endfor %}
337-
{# Then the youtube recordings #}
338-
{% for r in recordings %}
339-
{% if r.get_href and 'youtu' in r.get_href %}
340-
<tr>
341-
<td>
342-
<a href="{{ r.get_href }}"><i class="bi bi-file-slides"></i> {{ r.title }}</a>
343-
</td>
344-
</tr>
345-
{% endif %}
346-
{% endfor %}
347-
{# Finally, any other recordings #}
348-
{% for r in recordings %}
349-
{% if r.get_href and not 'audio' in r.get_href and not 'youtu' in r.get_href %}
350-
<tr>
351-
<td>
352-
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
353-
</td>
354-
</tr>
355-
{% endif %}
356-
{% endfor %}
357-
{% endif %}
358-
{% endwith %}
359-
{% if session.video_stream_url %}
360-
<tr>
361-
<td>
362-
<a href="{{ session.session_recording_url }}">
363-
<i class="bi bi-file-slides"></i> Session recording
364-
</a>
365-
</td>
366-
</tr>
323+
{% with session.recordings as recordings %}
324+
{% if recordings %}
325+
{# There's no guaranteed order, so this is a bit messy: #}
326+
{# First, the audio recordings, if any #}
327+
{% for r in recordings %}
328+
{% if r.get_href and 'audio' in r.get_href %}
329+
<tr>
330+
<td>
331+
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
332+
</td>
333+
</tr>
334+
{% endif %}
335+
{% endfor %}
336+
{# Then the youtube recordings #}
337+
{% for r in recordings %}
338+
{% if r.get_href and 'youtu' in r.get_href %}
339+
<tr>
340+
<td>
341+
<a href="{{ r.get_href }}"><i class="bi bi-file-slides"></i> {{ r.title }}</a>
342+
</td>
343+
</tr>
344+
{% endif %}
345+
{% endfor %}
346+
{# Finally, any other recordings #}
347+
{% for r in recordings %}
348+
{% if r.get_href and not 'audio' in r.get_href and not 'youtu' in r.get_href %}
349+
<tr>
350+
<td>
351+
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
352+
</td>
353+
</tr>
354+
{% endif %}
355+
{% endfor %}
367356
{% endif %}
357+
{% endwith %}
358+
{% if session.session_recording_url %}
359+
<tr>
360+
<td>
361+
<a href="{{ session.session_recording_url }}">
362+
<i class="bi bi-file-slides"></i>
363+
Meetecho session recording
364+
</a>
365+
</td>
366+
</tr>
368367
{% endif %}
369368
</tbody>
370369
</table>

0 commit comments

Comments
 (0)