- Check if hook is enabled before constructing hook notification items

- Skip/early exit email hook if notification item is not a VCALENDAR
This commit is contained in:
Nate Harris
2026-03-30 01:55:03 -06:00
parent 89edf01757
commit 3b9df7b87e
7 changed files with 123 additions and 61 deletions

View File

@@ -930,12 +930,21 @@ class Hook(BaseHook):
self.email_config
)
@property
def enabled(self) -> bool:
"""Check if this hook is enabled (has a notify method)."""
return self.email_config.host is not None
def notify(self, notification_item) -> None:
"""
Entrypoint for processing a single notification item.
Overrides default notify method from BaseHook.
Triggered by Radicale when a notifiable event occurs (e.g. item added, updated or deleted)
"""
# Skip any non-VCALENDAR items
if not notification_item.is_calendar_item:
return
if isinstance(notification_item, HookNotificationItem):
self._process_event_and_notify(notification_item)