Skip to content

AM-1084 city pass: scheduled notification - #231

Merged
fhaver-amsterdam merged 9 commits into
mainfrom
city-pass/am-1084-schedule-notifications
Aug 17, 2026
Merged

AM-1084 city pass: scheduled notification#231
fhaver-amsterdam merged 9 commits into
mainfrom
city-pass/am-1084-schedule-notifications

Conversation

@fhaver-amsterdam

@fhaver-amsterdam fhaver-amsterdam commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Changes

This PR updates the City Pass (and modules) notification flow to support scheduling notifications via send_at, including admin UX changes and service-side creation/deletion of scheduled notifications, alongside routine dependency bumps.

Changes:

  • Updated notification services/admin flows to upsert scheduled notifications using a deterministic identifier and to delete scheduled notifications when send_at is cleared/canceled.
  • Updated admin confirmation templates to reflect scheduling and show a “modification deadline”.
  • Refreshed dependency lockfiles (uv.lock, requirements.txt) and updated/extended unit + integration tests around scheduled notifications.

Affected services

  • city_pass
  • modules

Definition of done

  • API is backwards compatible (make openapi-diff)
  • Swagger UI up-to-date & tested (make dev)
  • Dependencies updated (make requirements)
    - [ ] Infrastructure config updated (aapp_azure_infra)
    - [ ] Loadtests for relevant endpoints (aapp_testing_loadtests)

After PR created (and deployed on dev):

  • Manual check on dev (o) e.g. use feature via Swagger or admin panel
  • Sanity check on test app (check that dev environment is selected)
    ^ stadspas is niet beschikbaar op ontwikkel omgeving

Other notes

GitHub Copilot was used in writing the code

@fhaver-amsterdam
fhaver-amsterdam requested review from a team and a lite review from Copilot August 10, 2026 08:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the City Pass (and modules) notification flow to support scheduling notifications via send_at, including admin UX changes and service-side creation/deletion of scheduled notifications, alongside routine dependency bumps.

Changes:

  • Updated notification services/admin flows to upsert scheduled notifications using a deterministic identifier and to delete scheduled notifications when send_at is cleared/canceled.
  • Updated admin confirmation templates to reflect scheduling and show a “modification deadline”.
  • Refreshed dependency lockfiles (uv.lock, requirements.txt) and updated/extended unit + integration tests around scheduled notifications.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
uv.lock Bumps multiple pinned dependency versions in the uv lockfile.
requirements.txt Updates exported/pinned requirements to match new lock state.
modules/admin/notification_admin.py Ensures scheduled notifications are deleted when scheduling is canceled/removed (modules app).
core/templates/admin/notification_confirm_send.html Adjusts admin confirmation copy/UI for “scheduled” notifications and shows a deadline.
city_pass/tests/services/test_notification.py Updates/extends service tests to use send_at scheduling and verify scheduled time is preserved.
city_pass/services/notification.py Switches to scheduling-only upsert when send_at is set; adds deterministic identifier + delete helper.
city_pass/integration_tests/test_notifications.py Updates integration tests to cover scheduled notification behavior.
city_pass/admin/notification_admin.py Adds scheduling-aware admin behavior (confirm flow, lock window, delete behavior, deadline display).
Suppressed comments (2)

city_pass/admin/notification_admin.py:60

  • has_delete_permission returns True for any unlocked object, bypassing Django’s built-in delete permission checks (e.g. city_pass.delete_notification). Delegate to super() and only add the lock constraint.
    def has_delete_permission(self, request, obj=None):
        if obj and self._notification_is_locked(obj):
            return False
        return True

city_pass/admin/notification_admin.py:163

  • The “Verstuurd?” flag currently becomes True for any scheduled notification with a future send_at (because send_at is set and nr_sessions is populated). This will incorrectly mark future scheduled notifications as already sent in the admin list.
    @admin.display(boolean=True, description="Verstuurd?")
    def send(self, obj) -> bool:
        return obj.send_at is not None and obj.nr_sessions > 0

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread city_pass/admin/notification_admin.py Outdated
Comment thread city_pass/admin/notification_admin.py
Comment thread city_pass/admin/notification_admin.py
Comment thread modules/admin/notification_admin.py Outdated
Comment thread core/templates/admin/notification_confirm_send.html Outdated
Comment thread city_pass/services/notification.py
@RikSchefferAmsterdam RikSchefferAmsterdam self-assigned this Aug 17, 2026
@fhaver-amsterdam
fhaver-amsterdam merged commit e8bf517 into main Aug 17, 2026
31 checks passed
@fhaver-amsterdam
fhaver-amsterdam deleted the city-pass/am-1084-schedule-notifications branch August 17, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants