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

- Include legacy "content" parameter in HookNotificationItem usage

This commit is contained in:
Nate Harris 2025-07-19 23:29:18 -06:00
parent 5922cc04e3
commit 070ba2d603
3 changed files with 22 additions and 19 deletions

View file

@ -254,6 +254,8 @@ class ApplicationPartPut(ApplicationBase):
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.UPSERT,
path=access.path,
content=existing_item.serialize(),
uid=None,
old_content=existing_item.serialize(),
new_content=item.serialize()
)
@ -261,6 +263,8 @@ class ApplicationPartPut(ApplicationBase):
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.UPSERT,
path=access.path,
content=item.serialize(),
uid=None,
old_content=None,
new_content=item.serialize()
)
@ -282,21 +286,14 @@ class ApplicationPartPut(ApplicationBase):
try:
uploaded_item, replaced_item = parent_item.upload(href, prepared_item)
etag = uploaded_item.etag
if replaced_item:
# If the item was replaced, we notify with the old content
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.UPSERT,
path=access.path,
old_content=replaced_item.serialize(),
new_content=prepared_item.serialize()
)
else: # If it was a new item, we notify with no old content
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.UPSERT,
path=access.path,
old_content=None,
new_content=prepared_item.serialize()
)
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.UPSERT,
path=access.path,
content=prepared_item.serialize(),
uid=None,
old_content=replaced_item.serialize() if replaced_item else None,
new_content=prepared_item.serialize()
)
self._hook.notify(hook_notification_item)
except ValueError as e:
# return better matching HTTP result in case errno is provided and catched