소스 검색

Merge branch 'dev' into release/0.25

Jeremy 2 년 전
부모
커밋
0562912f87
4개의 변경된 파일33개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      coderedcms/models/page_models.py
  2. 6 0
      coderedcms/views.py
  3. 1 0
      docs/releases/index.rst
  4. 15 0
      docs/releases/v0.25.1.rst

+ 11 - 0
coderedcms/models/page_models.py

@@ -845,14 +845,25 @@ class CoderedEventPage(CoderedWebPage, BaseEvent):
         ical_event.add('summary', self.title)
         # needs to get full page url, not just slug
         desc_str = _('Details')
+        ical_event.add('dtstamp', timezone.now())
         ical_event.add('description', f'{desc_str}: {self.full_url}')
+        # NOTE: The use of the url for the id is technically breaking the iCal standard,
+        #  which recommends against use of identifiable info:
+        # https://icalendar.org/New-Properties-for-iCalendar-RFC-7986/5-3-uid-property.html
+        # If this breaks in the future,
+        # implementing a uuid field on the object is probably necessary.
+        ical_event.add('uid', self.get_full_url())
         if self.address:
             ical_event.add('location', self.address)
 
         if dt_start:
+            # Convert to utc to remove timezone confusion
+            dt_start = dt_start.astimezone(timezone.utc)
             ical_event.add('dtstart', dt_start)
 
             if dt_end:
+                # Convert to utc to remove timezone confusion
+                dt_end = dt_end.astimezone(timezone.utc)
                 ical_event.add('dtend', dt_end)
 
             # Add a reminder alarm

+ 6 - 0
coderedcms/views.py

@@ -150,6 +150,8 @@ def event_generate_single_ical_for_event(request):
 
     # Generate the ical file.
     ical = Calendar()
+    ical.add('prodid', '-//Wagtail CRX//')
+    ical.add('version', '2.0')
     ical.add_component(event.create_single_ical(dt_start=dt_start, dt_end=dt_end))
     response = HttpResponse(ical.to_ical(), content_type="text/calendar")
     response['Filename'] = "{0}.ics".format(event.slug)
@@ -173,6 +175,8 @@ def event_generate_recurring_ical_for_event(request):
 
     # Generate the ical file.
     ical = Calendar()
+    ical.add('prodid', '-//Wagtail CRX//')
+    ical.add('version', '2.0')
     for e in event.create_recurring_ical():
         ical.add_component(e)
     response = HttpResponse(ical.to_ical(), content_type="text/calendar")
@@ -197,6 +201,8 @@ def event_generate_ical_for_calendar(request):
 
     # Generate the ical file.
     ical = Calendar()
+    ical.add('prodid', '-//Wagtail CRX//')
+    ical.add('version', '2.0')
     for event_page in page.get_index_children():
         for e in event_page.specific.create_recurring_ical():
             ical.add_component(e)

+ 1 - 0
docs/releases/index.rst

@@ -22,6 +22,7 @@ Wagtail CRX (previously CodeRed CMS) follows the
 .. toctree::
     :maxdepth: 1
 
+    v0.25.1
     v0.25.0
     v0.24.1
     v0.24.0

+ 15 - 0
docs/releases/v0.25.1.rst

@@ -0,0 +1,15 @@
+v0.25.1 release notes
+=====================
+
+
+Bug fixes
+---------
+
+* Correct generation of .ics files to be consistent with the iCal format, fixing
+  compatability with Outlook for Mac and other highly compliant software.
+
+
+Thank you!
+----------
+
+Thanks to everyone who contributed to `0.25.1 on GitHub <https://github.com/coderedcorp/coderedcms/milestone/41>`_.