1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-01 18:18:31 +00:00

Improved notification message with user/calendar point as field

This commit is contained in:
Tuna Celik 2020-08-17 14:43:52 +02:00
parent da31f80ba5
commit bf5272e83d
3 changed files with 16 additions and 2 deletions

View file

@ -1,7 +1,7 @@
import json
from enum import Enum
from radicale import utils
from radicale import pathutils, utils
INTERNAL_TYPES = ("none", "rabbitmq")
@ -33,10 +33,20 @@ class HookNotificationItemTypes(Enum):
DELETE = "delete"
def _cleanup(path):
sane_path = pathutils.strip_path(path)
attributes = sane_path.split("/") if sane_path else []
if len(attributes) < 2:
return ""
return attributes[0] + "/" + attributes[1]
class HookNotificationItem:
def __init__(self, notification_item_type, content):
def __init__(self, notification_item_type, path, content):
self.type = notification_item_type.value
self.point = _cleanup(path)
self.content = content
def to_json(self):