From f12d5743311d77bff76bcec331154d2b2a97fda5 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Fri, 24 Aug 2018 15:12:11 +0200 Subject: [PATCH] allow booking's ics 'summary' field overriding (#25820) --- chrono/agendas/models.py | 2 +- tests/test_api.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chrono/agendas/models.py b/chrono/agendas/models.py index 4d0c7dc..145ef07 100644 --- a/chrono/agendas/models.py +++ b/chrono/agendas/models.py @@ -382,7 +382,7 @@ class Booking(models.Model): vevent = vobject.newFromBehavior('vevent') vevent.add('uid').value = '%s-%s-%s' % (self.event.start_datetime.isoformat(), self.event.agenda.pk, self.pk) - vevent.add('summary').value = self.label + vevent.add('summary').value = request and request.GET.get('summary') or self.label vevent.add('dtstart').value = self.event.start_datetime if self.user_name: vevent.add('attendee').value = self.user_name diff --git a/tests/test_api.py b/tests/test_api.py index db68a2b..88950bb 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -412,6 +412,7 @@ def test_booking_ics(app, some_data, meetings_agenda, user): assert 'COMMENT:booking comment\r\n' in booking_ics assert 'LOCATION:bar\r\n' in booking_ics assert 'DESCRIPTION:booking description\r\n' in booking_ics + assert 'SUMMARY:l\r\n' in booking_ics # unauthenticated app.authorization = None @@ -422,12 +423,13 @@ def test_booking_ics(app, some_data, meetings_agenda, user): assert resp.headers['Content-Type'] == 'text/calendar' params = {'description': 'custom booking description', 'location': 'custom booking location', - 'comment': 'custom comment', 'url': 'http://example.com/custom'} + 'comment': 'custom comment', 'url': 'http://example.com/custom', 'summary': 'my booking'} resp = app.get('/api/booking/%s/ics/' % booking_id, params=params) assert 'DESCRIPTION:custom booking description\r\n' in resp.text assert 'LOCATION:custom booking location\r\n' in resp.text assert 'COMMENT:custom comment\r\n' in resp.text assert 'URL:http://example.com/custom\r\n' in resp.text + assert 'SUMMARY:my booking\r\n' in resp.text meetings_agenda_id = Agenda.objects.filter(label=u'Foo bar Meeting')[0].id meeting_type = MeetingType.objects.get(agenda=meetings_agenda) -- 2.18.0