fix(Nextcloud): Use current notification app name, handle admin_notifications

- The first notification's app name was used (leftover from testing)
instead of the current one.
- `admin_notifications` now display properly
This commit is contained in:
Jiří Štefka 2025-01-14 10:56:07 +01:00
parent 00ef0d7861
commit e2808e4026
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -171,7 +171,11 @@ def main():
last_datetime = datetime.fromisoformat(notification["datetime"]) last_datetime = datetime.fromisoformat(notification["datetime"])
log.info("New notifications received.") log.info("New notifications received.")
title = f"Nextcloud - {translate_app_name(data["ocs"]["data"][0]["app"])}: {data["ocs"]["data"][0]["subject"]}" title = ""
if notification["app"] == "admin_notifications":
title = f"Nextcloud: {notification["subject"]}"
else:
title = f"Nextcloud - {translate_app_name(notification["app"])}: {notification["subject"]}"
log.debug(f"Notification title: {title}") log.debug(f"Notification title: {title}")
message = notification["message"] message = notification["message"]