feat(notifs): move organization notification settings to the user level#12131
feat(notifs): move organization notification settings to the user level#12131maximevast wants to merge 19 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
OpenAPI ChangesOperations
Schemas
|
|
Preview Environment |
There was a problem hiding this comment.
2 issues found across 13 files
Confidence score: 4/5
- This PR looks safe to merge overall, with moderate confidence issues limited to API typing completeness rather than a clear runtime break.
- In
clients/packages/client/src/v1.ts, both GET and PATCH notification-settings operations are missing documented 404 response types, which can create a client contract mismatch and weaker error handling for non-member access paths. - Because both findings are severity 5/10 and focused on typed response coverage, the risk appears manageable but worth addressing soon to keep generated client behavior aligned with the API spec.
- Pay close attention to
clients/packages/client/src/v1.ts- add the missing 404 response typings for notification-settings GET/PATCH to prevent contract drift.
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| } | ||
| }, | ||
| ) | ||
| async def update_my_notification_settings( |
There was a problem hiding this comment.
Big nit-pick, but if GET | PATCH /me methods are called get|update_authenticated, then maybe we should name these methods
update_authenticated_notification_settings?
There was a problem hiding this comment.
good point, clauding now...
…er)/settings/SettingsPage.tsx Co-authored-by: Pieter Beulque <pieterbeulque@gmail.com>
…arsource/polar into maxime/user-org-notifs-settings-wire
|
🚀 Expo preview is ready!
|
Summary
**Related Issue: #12101
What
Moves organization notification settings (
new_order,new_subscription)from the org level to the user level, so each member controls their own
emails instead of one shared org-wide toggle.
Why
Adding granularity to the notifications settings; allowing users independently enable or disable notifications for an organisation.
How
GET/PATCH /users/me/organizations/{id}/notification-settingsendpoints; dispatch now filters per-member in
send_to_org_members.members (soft-deleted included).
Rollout (no downtime)
The new column is nullable for now. While it's
NULL, both backend dispatchand the frontend fall back to the org-level value, so behavior is unchanged
until the backfill runs.
Follow-up PR (cleanup): run the backfill, make the column non-null, drop
the org-level fallbacks, and remove the org-level
notification_settingscolumn. Marked in-code with
TODO (maxime).Tests
Service-level filtering + fallback (
tests/notifications/test_service.py) andthe endpoint contract incl. 404 on non-member (
tests/user/test_endpoints.py).Checklist
uv run task lint && uv run task lint_types)Summary by cubic
Move organization notification settings to the user level so each member controls emails for new orders and subscriptions. Web and mobile now read/write per-user preferences, and notification delivery filters per member.
New Features
/v1/users/me/organizations/{organization_id}/notification-settingswith 404 for non‑members; OpenAPI operations use “authenticated” naming; endpoints useAuthorizeUser;@polar-sh/clientupdated; new hooksuseUserOrganizationNotificationSettingsanduseUpdateUserOrganizationNotificationSettings.Migration
server/scripts/backfill_user_organization_notification_settings.pyto copy org-level settings to memberships.Written for commit 1072761. Summary will update on new commits.