get description text as text again

This commit is contained in:
Marc Durepos 2024-05-28 10:30:56 -04:00
parent f61d759737
commit babd69fad9

View file

@ -148,8 +148,8 @@ class CalendarEvent(models.Model):
ical_event.add('dtstamp', event.write_date.replace(tzinfo=None)) ical_event.add('dtstamp', event.write_date.replace(tzinfo=None))
if event.name: if event.name:
ical_event.add('summary', event.name) ical_event.add('summary', event.name)
if event.description: if self.html_to_text(event.description):
ical_event.add('description', event.description) ical_event.add('description', self.html_to_text(event.description))
if event.location: if event.location:
ical_event.add('location', event.location) ical_event.add('location', event.location)
if event.videocall_location: if event.videocall_location:
@ -312,13 +312,14 @@ class CalendarEvent(models.Model):
end = component.decoded('dtend') end = component.decoded('dtend')
if isinstance(end, datetime): if isinstance(end, datetime):
end = end.replace(tzinfo=None) end = end.replace(tzinfo=None)
values = { values = {
'name': str(component.get('summary')), 'name': str(component.get('summary')),
'start': start, 'start': start,
'stop': end, 'stop': end,
'description': str(component.get('description')), 'description': self._extract_component_text(component, 'description'),
'location': str(component.get('location')), 'location': self._extract_component_text(component, 'location'),
'videocall_location': str(component.get('conference')), 'videocall_location': self._extract_component_text(component, 'conference'),
'caldav_uid': uid, 'caldav_uid': uid,
'partner_ids': [(6, 0, attendee_ids.ids)], 'partner_ids': [(6, 0, attendee_ids.ids)],
} }
@ -336,6 +337,10 @@ class CalendarEvent(models.Model):
'follow_recurrence': True, 'follow_recurrence': True,
}) })
existing_instance.with_context({'caldav_no_sync': True}).write(values) existing_instance.with_context({'caldav_no_sync': True}).write(values)
@staticmethod
def _extract_component_text(component, subcomponent_name):
text = str(component.get(subcomponent_name))
text = text if text != 'None' else ''
@staticmethod @staticmethod