Skip to content

Commit

Permalink
feat: show existing recordings on materials page (#8102)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
holloway authored Nov 6, 2024
1 parent afbe6aa commit 5348aef
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 44 deletions.
34 changes: 34 additions & 0 deletions ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,40 @@ def test_meeting_agenda(self):
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(
Expand Down
87 changes: 43 additions & 44 deletions ietf/templates/meeting/session_details_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,51 +320,50 @@ <h3 class="mt-4">Notes and recordings</h3>
</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>
Expand Down

0 comments on commit 5348aef

Please sign in to comment.