From e584cb76a73449f16edbd8f225962fa522297c94 Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Thu, 17 Apr 2025 15:33:38 +0200 Subject: [PATCH] Fix typing and default results of availability persons/groups methods --- aleksis/core/mixins.py | 9 +++++---- aleksis/core/models.py | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/aleksis/core/mixins.py b/aleksis/core/mixins.py index c331b0cf1..22c16d346 100644 --- a/aleksis/core/mixins.py +++ b/aleksis/core/mixins.py @@ -726,9 +726,10 @@ class CalendarEventMixin(DAVResource, RegistryObject, is_registry=True): The list of objects used to create the calendar feed have to be provided by the method `get_objects` class method. It's mandatory to implement this method. - The list of objects whose respective events should be marked as blocking the respective - entities passed to it (persons, groups, ...) have to be provided by the `get_busy_objects` - class method. If the method is not implemented, no objects will be marked. + The list of objects whose respective events should be marked as being relevant to the + availability of the respective entities passed to it (persons, groups, ...) have to be + provided by the `get_availability_objects` class method. If the method is not implemented, + no objects will be marked. To provide the data for the events, a certain set of class methods can be implemented. The following iCal attributes are supported: @@ -886,7 +887,7 @@ class CalendarEventMixin(DAVResource, RegistryObject, is_registry=True): return qs @classmethod - def get_busy_objects(cls, request: HttpRequest, obj) -> Iterable: + def get_availability_objects(cls, request: HttpRequest, obj) -> Iterable: """Return the objects whose events should be marked as blocking.""" return None diff --git a/aleksis/core/models.py b/aleksis/core/models.py index 9205d186b..82284ff52 100644 --- a/aleksis/core/models.py +++ b/aleksis/core/models.py @@ -1739,13 +1739,13 @@ class CalendarEvent( calendar_alarm.get_alarm(request) for calendar_alarm in reference_object.alarms.all() ] - def get_availability_persons(self) -> QuerySet: + def get_availability_persons(self) -> list[Person]: """Return the persons whose availability is affected by the event.""" - raise NotImplementedError() + return [] - def get_availability_groups(self) -> QuerySet: + def get_availability_groups(self) -> list[Group]: """Return the groups whose availability is affected by the event.""" - raise NotImplementedError() + return [] @classmethod def get_objects( -- GitLab