Commit graph

26 commits

Author SHA1 Message Date
a84e2b3793 FEAT(notifications): pass action_code through in Gotify extras
get_gotify_extras() previously only ever surfaced the *resolved* click_url,
never the action_code that produced it -- so the frontend had no way to
know which action_code a notification carried, and got nothing at all for
a code that hasn't been configured in NotificationLink yet. Now
action_code rides along under client::notification.action_code whenever
it's set, independent of whether it resolved to a click_url. Verified live
against a running Gotify container, both resolved and unresolved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 11:35:33 +03:30
a643fee027 FIX(notifications): action_code accepts dots, PushMessage.stats actually updates
Found by an end-to-end run against a live Gotify container:

- action_code / NotificationLink.action_code were SlugField, which rejects
  dots. Every documented action_code (billboard.approved, escrow.timeout,
  ...) is dotted, so any real request using the catalog got a 400 before
  this fix -- only click_url ever worked. Switched both to CharField with
  a validator that keeps slug's charset but allows ".".
- send_push_notification set push_message.state instead of .stats after a
  successful send, so PushMessage.stats stayed stuck at INIT forever
  regardless of delivery outcome. Fixed the attribute name and scoped the
  save with update_fields.

Verified live: POST with a dotted action_code now resolves through
NotificationLink and lands in Gotify with the correct click.url, and the
PushMessage row flips to DONE.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01 15:55:17 +03:30
3f739ad169 FEAT(notifications): management command to seed NotificationLink rows
Adds `seed_notification_links`, which upserts one NotificationLink row per
action_code documented in docs/frontend-notification-click-actions.md (12
billboard + 15 escrow codes), each active with a sample url_template
(https://app.gooyal.ir/ads/{object_id} / .../escrow/{object_id}). Lets
producer notifications resolve a click_url end to end today; the real
routes still need confirming with whoever owns the frontend, and can be
edited any time via the Django admin. Run with --force to overwrite rows
that already exist; existing rows are otherwise left untouched so manual
admin edits aren't clobbered by a rerun.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01 12:05:32 +03:30
2dbe021fe5 REFACTOR(notifications): rename code/click_object_id to action_code/click_object_id_value
`code` was ambiguous next to Python's own use of "code"; `action_code` names
its actual role (a click-action lookup key). click_object_id_value pairs it
consistently with action_code. Renamed on both PushMessage and
NotificationLink via a data-preserving RenameField migration, threaded
through the serializer, admin, bulk-push path, and docs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 12:13:29 +03:30
707407bb52 FEAT(notifications): admin-managed code -> URL mapping for click actions
The click_url a producer sends had to be built in that producer's own
Python code (utils/deep_links.py in advertising), so changing the URL
scheme meant a code deploy. Adds NotificationLink: an admin-editable
(code, url_template, is_active) row per notification type, with
url_template supporting a {object_id} placeholder.

PushMessage gains `code` and `click_object_id` — a producer can send either
a raw click_url (unchanged, still wins if both are given) or a code + the
referenced object's id, and resolve_click_url() looks up the template at
send time. An unset or not-yet-configured/inactive code resolves to no
click action rather than an error, consistent with "not every notification
is clickable." Wired through both the single-push API (serializer) and the
bulk Excel path (two new optional columns).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 14:35:55 +03:30
8f83a5e84a FEAT(notifications): add optional click_url for notification tap actions
Not every notification is clickable, so click_url is optional end to end
(null/blank on the model, required=False on the serializer). When set, it's
merged into Gotify's own client::notification.click.url extras convention
without disturbing any other extras a producer already sends, so official
Gotify clients can open it on tap. Wired through both message-creation
paths: the single-push REST API and the bulk Excel upload. Also fixes a
pre-existing NameError in the bulk path (json.loads(extras) referenced an
undefined name instead of extras_str).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 09:36:06 +03:30
Sayyid Hamid Mahdavi
66862e8d5d fail_silently=True 2026-04-22 14:20:37 +03:30
Sayyid Hamid Mahdavi
6452eac332 email content 2025-09-07 15:14:20 +03:30
Sayyid Hamid Mahdavi
f58704aa5b email content 2025-09-07 15:13:05 +03:30
Sayyid Hamid Mahdavi
f91f279a5a celery beat 2025-09-06 17:44:07 +03:30
Sayyid Hamid Mahdavi
4c7587e6e0 celery beat 2025-09-06 17:26:10 +03:30
Sayyid Hamid Mahdavi
6795e415f1 celery beat 2025-09-06 17:00:21 +03:30
Sayyid Hamid Mahdavi
64644a5a67 email 2025-09-06 12:22:56 +03:30
Sayyid Hamid Mahdavi
fd4590f611 email 2025-09-06 12:22:07 +03:30
Sayyid Hamid Mahdavi
5ac1715adb bulk push 2025-09-02 20:12:20 +03:30
Sayyid Hamid Mahdavi
0901d3e323 bulk push 2025-07-19 15:41:36 +03:30
Sayyid Hamid Mahdavi
2d4974369f add celery 2025-07-17 12:15:32 +03:30
Sayyid Hamid Mahdavi
a5f1e1340a add celery 2025-07-17 12:03:18 +03:30
Sayyid Hamid Mahdavi
ff3e5d3bed add celery 2025-07-15 17:32:06 +03:30
Sayyid Hamid Mahdavi
e442f00cb0 send message api 2025-07-15 14:00:15 +03:30
Sayyid Hamid Mahdavi
40d3579d13 send message api 2025-07-15 13:59:42 +03:30
Sayyid Hamid Mahdavi
da9e640440 add application_token 2025-07-01 15:32:47 +03:30
Sayyid Hamid Mahdavi
3e7ca34f26 add static files 2025-07-01 15:15:21 +03:30
Sayyid Hamid Mahdavi
7af1af9e5c get client token 2025-07-01 12:35:51 +03:30
Sayyid Hamid Mahdavi
3dd06a98d1 init 2025-06-29 22:15:11 +03:30
Sayyid Hamid Mahdavi
ac5356bf9c init 2025-06-29 17:09:37 +03:30