♻️ move recurring event canellation into method
This commit is contained in:
parent
1d62cab68d
commit
4752e9d555
|
|
@ -158,6 +158,14 @@ class DavEvent:
|
|||
self.is_deleted = True
|
||||
self.obj.delete()
|
||||
|
||||
def cancel(self):
|
||||
"""
|
||||
Cancel the event.
|
||||
:return:
|
||||
"""
|
||||
self.obj.icalendar_component["status"] = "CANCELLED"
|
||||
self.obj.save(no_create=True)
|
||||
|
||||
def serialize(self) -> dict[str, str | datetime | timedelta]:
|
||||
"""
|
||||
Serialize the event to a dictionary.
|
||||
|
|
@ -314,8 +322,7 @@ def clear(target_calendars: list, is_test: bool=False) -> dict:
|
|||
# we need to cancel it now
|
||||
elif not event.is_cancelled:
|
||||
if not is_test:
|
||||
event.obj.icalendar_component["status"] = "CANCELLED"
|
||||
event.obj.save()
|
||||
event.cancel()
|
||||
is_cancelled = True
|
||||
result["cancellation_type"] = "cancelled"
|
||||
results["cancelled_overlapping_recurring_events"].append(result)
|
||||
|
|
|
|||
Loading…
Reference in New Issue