From 780534a42673192fdd6446cc24b50158cc566f61 Mon Sep 17 00:00:00 2001 From: Ali Asadi Date: Sat, 22 Aug 2026 09:36:13 +0330 Subject: [PATCH] FEAT(notifications): accept optional click_url in push_user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passes through to the notifications service, which embeds it as the Gotify tap destination when set. Optional — no existing call site changes, most notifications stay non-clickable. Co-Authored-By: Claude Sonnet 5 --- utils/clients/notifications_client.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/clients/notifications_client.py b/utils/clients/notifications_client.py index c3c324b..dea595c 100644 --- a/utils/clients/notifications_client.py +++ b/utils/clients/notifications_client.py @@ -54,11 +54,12 @@ class _PushBody: these fields are sent (mirrors the advertising service's client). """ - def __init__(self, title: str, message: str, priority: int, extras): + def __init__(self, title: str, message: str, priority: int, extras, click_url=None): self._title = title self._message = message self._priority = priority self._extras = extras + self._click_url = click_url def to_dict(self) -> dict: return { @@ -66,16 +67,20 @@ class _PushBody: "message": self._message, "priority": self._priority, "extras": self._extras, + "click_url": self._click_url, } -def push_user(user_uuid, title: str, message: str, priority: int = 5, extras=None): +def push_user(user_uuid, title: str, message: str, priority: int = 5, extras=None, click_url=None): """ Send a push notification to a single user via the gooyal notifications service. Requires the `notifications.application.push:send` scope on this app's OAuth2 client credentials. Raises on failure — callers decide whether a down notifications service should be swallowed. + + `click_url` is optional — most notifications aren't clickable. When set, + the notifications service embeds it as the tap destination. """ client = get_client() - body = _PushBody(title=title, message=message, priority=priority, extras=extras) + body = _PushBody(title=title, message=message, priority=priority, extras=extras, click_url=click_url) return push_application_application_create.sync(user_uuid=str(user_uuid), client=client, body=body) -- 2.45.3