Commit graph

41 commits

Author SHA1 Message Date
4765d9fa41 Merge pull request 'feature/notification-actions' (#5) from feature/notification-actions into master
Reviewed-on: #5
2026-09-02 04:19:07 -04:00
10f16578b7 Add postman collections 2026-09-02 11:37:10 +03:30
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
28cec7c5cd Merge pull request 'FIX(notifications): action_code accepts dots, PushMessage.stats actually updates' (#4) from feature/notification-actions into master
Reviewed-on: #4
2026-09-01 08:38:16 -04:00
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
8359084c86 Merge pull request 'feature/notification-actions' (#3) from feature/notification-actions into master
Reviewed-on: #3
2026-09-01 04:37:14 -04:00
8a69de8ff2 add winsoo in trusted origins 2026-09-01 12:06:27 +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
c919eef00f Merge pull request 'REFACTOR(notifications): rename code/click_object_id to action_code/click_object_id_value' (#2) from feature/notification-actions into master
Reviewed-on: #2
2026-08-23 10:25:35 -04:00
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
48a764caa7 Merge pull request 'feature/notification-actions' (#1) from feature/notification-actions into master
Reviewed-on: #1
2026-08-23 03:42:38 -04:00
d473f61790 docs(notifications): update docs for the code -> NotificationLink mechanism
Reflects the switch from hard-coded FRONTEND_BASE_URL/utils.deep_links to
admin-managed NotificationLink rows: implementation.md documents the
resolution logic and the new migration, frontend-notification-click-actions.md
replaces the "confirm your URL scheme" ask with the actual code catalog
(now that the scheme itself is an admin panel concern, not something the
frontend team needs to weigh in on for us to ship), and
notification-click-actions.md gets a pointer at the top so it reads as the
historical first pass it now is, not the current mechanism.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 15:23:45 +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
354bbc26cf docs(notifications): add service overview, implementation guide, and frontend handoff doc
Three docs for three audiences: service-overview.md for anyone integrating
with or operating the service, implementation.md for engineers maintaining
this codebase, and frontend-notification-click-actions.md as a self-contained
handoff for the client team to start building tap-to-navigate against — it
flags the click_url URL format as an unconfirmed placeholder needing their
input, and catalogs every notification type currently sending one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 11:39:30 +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
6aedf7aa2f chore: ignore __pycache__ and compiled Python files
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 09:35:53 +03:30
9a010aa97b FIX(notifications): configuration for GOTIFY_BASE_PUBLIC_URL
configuration for GOTIFY_BASE_PUBLIC_URL
2026-05-09 14:12:13 +03:30
Sayyid Hamid Mahdavi
66862e8d5d fail_silently=True 2026-04-22 14:20:37 +03:30
Sayyid Hamid Mahdavi
d5acae765c edit trusted origin 2026-04-22 14:12:47 +03:30
Sayyid Hamid Mahdavi
fac2f3e483 extras 2025-10-29 16:11:17 +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
9c8aad9088 bulk push 2025-07-19 15:43:59 +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
c3c45320d2 modify Dockerfile 2025-07-01 12:47:51 +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