feat: show existing recordings on materials page (#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
This commit is contained in:
Matthew Holloway 2024-11-06 08:52:04 +00:00 committed by GitHub
parent afbe6aa429
commit 5348aefef9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 77 additions and 44 deletions

View file

@ -407,6 +407,40 @@ class MeetingTests(BaseMeetingTestCase):
r = self.client.get(urlreverse('floor-plan', kwargs=dict(num=meeting.number)))
self.assertEqual(r.status_code, 200)
def test_session_recordings_via_factories(self):
session = SessionFactory(meeting__type_id="ietf")
self.assertEqual(session.meetecho_recording_name, "")
self.assertEqual(len(session.recordings()), 0)
url = urlreverse("ietf.meeting.views.session_details", kwargs=dict(num=session.meeting.number, acronym=session.group.acronym))
r = self.client.get(url)
q = PyQuery(r.content)
# debug.show("q('#notes_and_recordings_1')")
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 1)
link = q("#notes_and_recordings_1 tr a")
self.assertEqual(len(link), 1)
self.assertEqual(link[0].attrib['href'], str(session.session_recording_url()))
session.meetecho_recording_name = 'my_test_session_name'
session.save()
r = self.client.get(url)
q = PyQuery(r.content)
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 1)
links = q("#notes_and_recordings_1 tr a")
self.assertEqual(len(links), 1)
self.assertEqual(links[0].attrib['href'], session.session_recording_url())
new_recording_url = "https://www.youtube.com/watch?v=jNQXAC9IVRw"
new_recording_title = "Me at the zoo"
create_recording(session, new_recording_url, new_recording_title)
r = self.client.get(url)
q = PyQuery(r.content)
self.assertEqual(len(q("#notes_and_recordings_1 tr")), 2)
links = q("#notes_and_recordings_1 tr a")
self.assertEqual(len(links), 2)
self.assertEqual(links[0].attrib['href'], new_recording_url)
self.assertIn(new_recording_title, links[0].text_content())
#debug.show("q('#notes_and_recordings_1')")
def test_agenda_ical_next_meeting_type(self):
# start with no upcoming IETF meetings, just an interim
MeetingFactory(

View file

@ -320,51 +320,50 @@
</tr>
{% endif %}
{# Recordings #}
{% if session.has_recordings %}
{% with session.recordings as recordings %}
{% if recordings %}
{# There's no guaranteed order, so this is a bit messy: #}
{# First, the audio recordings, if any #}
{% for r in recordings %}
{% if r.get_href and 'audio' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{# Then the youtube recordings #}
{% for r in recordings %}
{% if r.get_href and 'youtu' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-slides"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{# Finally, any other recordings #}
{% for r in recordings %}
{% if r.get_href and not 'audio' in r.get_href and not 'youtu' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
{% if session.video_stream_url %}
<tr>
<td>
<a href="{{ session.session_recording_url }}">
<i class="bi bi-file-slides"></i> Session recording
</a>
</td>
</tr>
{% with session.recordings as recordings %}
{% if recordings %}
{# There's no guaranteed order, so this is a bit messy: #}
{# First, the audio recordings, if any #}
{% for r in recordings %}
{% if r.get_href and 'audio' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{# Then the youtube recordings #}
{% for r in recordings %}
{% if r.get_href and 'youtu' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-slides"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{# Finally, any other recordings #}
{% for r in recordings %}
{% if r.get_href and not 'audio' in r.get_href and not 'youtu' in r.get_href %}
<tr>
<td>
<a href="{{ r.get_href }}"><i class="bi bi-file-play"></i> {{ r.title }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
{% if session.session_recording_url %}
<tr>
<td>
<a href="{{ session.session_recording_url }}">
<i class="bi bi-file-slides"></i>
Meetecho session recording
</a>
</td>
</tr>
{% endif %}
</tbody>
</table>