Skip to content

Replace GiveBanner/StickyNote with SiteBanner and EmergencyMessaging#1682

Open
TomWoodward wants to merge 2 commits into
mainfrom
core-1761-sitebanner-emergency-messaging
Open

Replace GiveBanner/StickyNote with SiteBanner and EmergencyMessaging#1682
TomWoodward wants to merge 2 commits into
mainfrom
core-1761-sitebanner-emergency-messaging

Conversation

@TomWoodward
Copy link
Copy Markdown
Member

@TomWoodward TomWoodward commented May 28, 2026

Summary

  • Rebuilds the marketing-banner backend so multiple concurrent banners can be defined with scheduling and per-page targeting (the frontend will A/B test between matching banners and report variants to GA).
  • Splits the emergency-override path off into its own site setting (EmergencyMessaging) instead of co-habiting with the banner model.
  • Drops the legacy GiveBanner and StickyNote models and every reference to them (serializers, views, urls, signals, tests, wagtail admin).

API changes

  • GET /apps/cms/api/donations/sitebanner/ — list of active, in-date banners. Backend does not filter by URL/context; the frontend filters client-side so navigation can swap banners without a refetch.
  • GET /apps/cms/api/emergency/ — replaces GET /apps/cms/api/sticky/.
  • GET /apps/cms/api/snippets/givebanner/ — removed.

Wagtail admin

  • Site Messaging > Site Banners — manage banner campaigns (name, schedule, targeting, content).
  • Settings > Emergency Messaging — singleton for emergency-override content.

Implementation notes

  • SiteBanner uses TranslatableMixin and inherits TranslatableMixin.Meta so the (translation_key, locale) uniqueness constraint is preserved alongside the custom verbose_name/ordering.
  • The viewset filters by is_active=True and date windows (start_date/end_date nullable). Context/URL filtering lives entirely in the frontend.
  • Cloudfront invalidation signal swapped from StickyNoteEmergencyMessaging (key emergency).

Test plan

  • Apply migrations on staging
  • In Wagtail admin: create a Site Banner under Site Messaging > Site Banners, verify it appears in GET /apps/cms/api/donations/sitebanner/
  • Toggle is_active and confirm it disappears from the API
  • Set start/end dates outside the current window and confirm filtering
  • Configure Settings > Emergency Messaging and verify GET /apps/cms/api/emergency/ returns expected payload
  • Confirm /apps/cms/api/sticky/ and /apps/cms/api/snippets/givebanner/ 404
  • CI tests pass

Ticket

CORE-1761

Frontend changes in os-webview are tracked separately per the ticket.

🤖 Generated with Claude Code

Rebuilds the marketing-banner backend to support multiple concurrent
banners (for frontend A/B testing), scheduling, and per-page targeting,
and separates the emergency-override path into its own site setting.

- Add SiteBanner model + admin/serializer/viewset in donations app
- Add EmergencyMessaging BaseSiteSetting in global_settings
- Drop GiveBanner (snippets) and StickyNote (global_settings) and all
  references in serializers, views, urls, signals, and tests
- Replace /api/sticky/ with /api/emergency/; SiteBanner is served at
  /api/donations/sitebanner/

CORE-1761

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 19:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Comment thread donations/wagtail_hooks.py
Comment thread donations/views.py
Addresses PR review feedback:
- post_save signal clears donations/sitebanner CloudFront cache on edit
- Tests cover active/inactive, in-window/future/expired, and open-ended
  banners to lock in the SiteBannerViewSet filtering behavior

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants