Skip to content

Commit

Permalink
feat: Include remote instructions and onsite tool in ics files (#5182)
Browse files Browse the repository at this point in the history
* feat: Add remote_instructions for sessions to agenda.ics

* feat: Add webex/meetecho/remote_instructions to upcoming.ics

* fix: Remove location-based details from interims in upcoming.ics

Interim sessions don't ever seem to have locations, so they won't use
the new code anyway. Leave in the remote-instructions.

* test: Test inclusion/exclusion of remote_instructions in upcoming.ics

* test: Test inclusion/exclusion of remote_instructions in agenda.ics

* feat: Include onsite tool link in agenda.ics

* test: Test inclusion of meetecho onsite and remote URLs in agenda.ics
  • Loading branch information
jennifer-richards authored Feb 22, 2023
1 parent 90b6cf4 commit 4209698
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
42 changes: 34 additions & 8 deletions ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ class MeetingTests(BaseMeetingTestCase):
def test_meeting_agenda(self):
meeting = make_meeting_test_data()
session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
session.remote_instructions='https://remote.example.com'
session.save()
slot = TimeSlot.objects.get(sessionassignments__session=session,sessionassignments__schedule=meeting.schedule)
slot.location.urlresource_set.create(name_id='meetecho_onsite', url='https://onsite.example.com')
slot.location.urlresource_set.create(name_id='meetecho', url='https://meetecho.example.com')
#
self.write_materials_files(meeting, session)
#
Expand Down Expand Up @@ -316,7 +320,10 @@ def test_meeting_agenda(self):
assert_ical_response_is_valid(self, r)
self.assertContains(r, session.group.acronym)
self.assertContains(r, session.group.name)
self.assertContains(r, session.remote_instructions)
self.assertContains(r, slot.location.name)
self.assertContains(r, 'https://onsite.example.com')
self.assertContains(r, 'https://meetecho.example.com')
self.assertContains(r, "BEGIN:VTIMEZONE")
self.assertContains(r, "END:VTIMEZONE")

Expand Down Expand Up @@ -4582,18 +4589,34 @@ def test_upcoming_ical(self):
meeting = make_meeting_test_data(create_interims=True)
populate_important_dates(meeting)
url = urlreverse("ietf.meeting.views.upcoming_ical")


# Expect events 3 sessions - one for each WG and one for the IETF meeting
expected_event_summaries = [
'ames - Asteroid Mining Equipment Standardization Group',
'mars - Martian Special Interest Group',
'IETF 72',
]

Session.objects.filter(
meeting__type_id='interim',
group__acronym="mars",
).update(
remote_instructions='https://someurl.example.com',
)
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
assert_ical_response_is_valid(self, r,
expected_event_summaries=expected_event_summaries,
expected_event_count=len(expected_event_summaries))
self.assertContains(r, 'Remote instructions: https://someurl.example.com')

Session.objects.filter(meeting__type_id='interim').update(remote_instructions='')
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
# Expect events 3 sessions - one for each WG and one for the IETF meeting
assert_ical_response_is_valid(self, r,
expected_event_summaries=[
'ames - Asteroid Mining Equipment Standardization Group',
'mars - Martian Special Interest Group',
'IETF 72',
],
expected_event_count=3)
expected_event_summaries=expected_event_summaries,
expected_event_count=len(expected_event_summaries))
self.assertNotContains(r, 'Remote instructions:')

def test_upcoming_ical_filter(self):
# Just a quick check of functionality - details tested by test_js.InterimTests
Expand Down Expand Up @@ -5643,6 +5666,7 @@ def test_group_ical(self):
make_interim_test_data()
meeting = Meeting.objects.filter(type='interim', session__group__acronym='mars').first()
s1 = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
self.assertGreater(len(s1.remote_instructions), 0, 'Expected remote_instructions to be set')
a1 = s1.official_timeslotassignment()
t1 = a1.timeslot
# Create an extra session
Expand All @@ -5661,6 +5685,7 @@ def test_group_ical(self):
self.assertEqual(r.content.count(b'UID'), 2)
self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group')
self.assertContains(r, t1.local_start_time().strftime('%Y%m%dT%H%M%S'))
self.assertContains(r, s1.remote_instructions)
self.assertContains(r, t2.local_start_time().strftime('%Y%m%dT%H%M%S'))
self.assertContains(r, 'END:VEVENT')
#
Expand All @@ -5671,6 +5696,7 @@ def test_group_ical(self):
self.assertEqual(r.content.count(b'UID'), 1)
self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group')
self.assertContains(r, t1.time.strftime('%Y%m%dT%H%M%S'))
self.assertContains(r, s1.remote_instructions)
self.assertNotContains(r, t2.time.strftime('%Y%m%dT%H%M%S'))
self.assertContains(r, 'END:VEVENT')

Expand Down
10 changes: 7 additions & 3 deletions ietf/templates/meeting/agenda.ics
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ DTEND{% ics_date_time item.timeslot.local_end_time schedule.meeting.time_zone %}
DTSTAMP{% ics_date_time item.timeslot.modified|utc 'utc' %}{% if item.session.agenda %}
URL:{{item.session.agenda.get_versionless_href}}{% endif %}
DESCRIPTION:{{item.timeslot.name|ics_esc}}\n{% if item.session.agenda_note %}
Note: {{item.session.agenda_note|ics_esc}}\n{% endif %}{% if item.timeslot.location.webex_url %}
Note: {{item.session.agenda_note|ics_esc}}\n{% endif %}{% if item.timeslot.location.onsite_tool_url %}
\n
Webex: {{ item.timeslot.location.webex_url }}\n{% endif %}{% if item.timeslot.location.video_stream_url %}
Onsite tool: {{ item.timeslot.location.onsite_tool_url|format:item.session }}\n{% endif %}{% if item.timeslot.location.video_stream_url %}
\n
Meetecho: {{ item.timeslot.location.video_stream_url|format:item.session }}\n{% endif %}{% if item.session.agenda %}{% with agenda=item.session.agenda %}
Meetecho: {{ item.timeslot.location.video_stream_url|format:item.session }}\n{% endif %}{% if item.timeslot.location.webex_url %}
\n
Webex: {{ item.timeslot.location.webex_url }}\n{% endif %}{% if item.session.remote_instructions %}
\n
Remote instructions: {{ item.session.remote_instructions }}\n{% endif %}{% if item.session.agenda %}{% with agenda=item.session.agenda %}
\n
{{agenda.type}} {{agenda.get_versionless_href}}\n{% endwith %}{% endif %}
\n
Expand Down
13 changes: 7 additions & 6 deletions ietf/templates/meeting/upcoming.ics
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load humanize tz %}{% autoescape off %}{% load ietf_filters %}BEGIN:VCALENDAR
{% load humanize tz %}{% autoescape off %}{% load ietf_filters textfilters %}BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:-//IETF//datatracker.ietf.org ical upcoming//EN
Expand All @@ -10,14 +10,15 @@ SUMMARY:{% if item.session.name %}{{item.session.group.acronym|lower}} - {{item.
CLASS:PUBLIC
DTSTART{% ics_date_time item.timeslot.local_start_time item.schedule.meeting.time_zone %}
DTEND{% ics_date_time item.timeslot.local_end_time item.schedule.meeting.time_zone %}
DTSTAMP{% ics_date_time item.timeslot.modified|utc 'utc' %}
{% if item.session.agenda %}URL:{{item.session.agenda.get_href}}
DESCRIPTION:{{item.timeslot.name|ics_esc}}\n{% if item.session.agenda_note %}
DTSTAMP{% ics_date_time item.timeslot.modified|utc 'utc' %}{% if item.session.agenda %}
URL:{{item.session.agenda.get_href}}{% endif %}
DESCRIPTION:{% if item.timeslot.name %}{{item.timeslot.name|ics_esc}}\n{% endif %}{% if item.session.agenda_note %}
Note: {{item.session.agenda_note|ics_esc}}\n{% endif %}{% for material in item.session.materials.all %}
\n{{material.type}}{% if material.type.name != "Agenda" %}
({{material.title|ics_esc}}){% endif %}:
{{material.get_href}}\n{% endfor %}
{% endif %}END:VEVENT
{{material.get_href}}\n{% endfor %}{% if item.session.remote_instructions %}
Remote instructions: {{ item.session.remote_instructions }}\n{% endif %}
END:VEVENT
{% endfor %}{% for meeting in ietfs %}BEGIN:VEVENT
UID:ietf-{{ meeting.number }}
SUMMARY:IETF {{ meeting.number }}{% if meeting.city %}
Expand Down

0 comments on commit 4209698

Please sign in to comment.