Add pledge participants admin views#629
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## feat/sign_in_sign_up_mutations #629 +/- ##
==================================================================
+ Coverage 63.45% 63.55% +0.09%
==================================================================
Files 389 390 +1
Lines 41972 42157 +185
Branches 5413 5432 +19
==================================================================
+ Hits 26634 26791 +157
- Misses 13648 13669 +21
- Partials 1690 1697 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 285d5f42c9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
285d5f4 to
809b0bd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 809b0bdee0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
809b0bd to
4bd7558
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bd7558983
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
4bd7558 to
7700365
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7700365e37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7700365 to
ad15192
Compare
36e1496 to
3b98194
Compare
b560534 to
7abae22
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7abae2279d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Two surfaces for plan admins on plans with community engagement enabled: - A global Participants list under Pledges -> Participants (the Pledges menu becomes a submenu with Pledges and Participants children). Columns: email, commitment count, marketing opt-in. All sortable. Header buttons: Copy opted-in emails (clipboard) and Export opted-in emails as CSV. - A Participants tab on the pledge edit view scoped to that pledge. Same email + opt-in tick columns; same Copy/Export buttons. Both surfaces share _get_participants_queryset (plan-scoped, excludes anonymous PublicUsers via email IS NULL, annotates commitment_count) and _opted_in_emails (filters to marketing_consented_at IS NOT NULL, sorted). The CSV endpoints under /admin/pledge-participants/ are gated to the active plan and reject pledges outside it. The ParticipantsViewSet subclasses SnippetViewSet but overrides get_urlpatterns to expose only list/list_results (add/edit/delete view classes can't simply be nulled because SnippetViewSet hard-codes those routes). Permission policy is dedicated, separate from PledgePermissionPolicy, because the participants UI is read-only. The copy-to-clipboard JS is plain JS loaded via insert_global_admin_js; the button carries the opted-in email list in a data attribute so the copy is a one-click no-roundtrip operation.
fc54195 to
da060d2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da060d2db9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
da060d2 to
57c6fb0
Compare
57c6fb0 to
06d0e77
Compare
| # Wagtail's BooleanColumn reads bool() of the attribute. PublicUser.marketing_consented_at | ||
| # is a datetime-or-None; bool(datetime) is True, bool(None) is False, so the column | ||
| # already does the right thing as long as we expose `has_marketing_consent` as a property. | ||
| def _has_marketing_consent(self: PublicUser) -> bool: | ||
| return self.marketing_consented_at is not None | ||
|
|
||
|
|
||
| PublicUser.has_marketing_consent = property(_has_marketing_consent) # type: ignore[attr-defined] |
There was a problem hiding this comment.
This may have been discussed before already, and I don't want to restart a discussion. But are there any benefits to using a datetime instead of a Boolean for the marketing consent? In general, one could always use a datetime instead of a Boolean. But it may be an unnecessary complication if there is no clear benefit.
Description
Two surfaces for plan admins on plans with community engagement enabled:
Both surfaces share _get_participants_queryset (plan-scoped, excludes anonymous PublicUsers via email IS NULL, annotates commitment_count) and _opted_in_emails (filters to marketing_consented_at IS NOT NULL, sorted). The CSV endpoints under /admin/pledge-participants/ are gated to the active plan and reject pledges outside it.
The ParticipantsViewSet subclasses SnippetViewSet but overrides get_urlpatterns to expose only list/list_results (add/edit/delete view classes can't simply be nulled because SnippetViewSet hard-codes those routes). Permission policy is dedicated, separate from PledgePermissionPolicy, because the participants UI is read-only.
The copy-to-clipboard JS is plain JS loaded via insert_global_admin_js; the button carries the opted-in email list in a data attribute so the copy is a one-click no-roundtrip operation.
Screenshots/Videos (if applicable)
Add screenshots or videos demonstrating the changes if applicable.
Related issue
https://app.asana.com/1/1201243246741462/project/1206017643443542/task/1215606704588443
https://app.asana.com/1/1201243246741462/project/1206017643443542/task/1215606704588431
Requirements, dependencies and related PRs
Base: #626
Additional Notes
Any additional information that reviewers should know about this PR.
✅ Pre-Merge Checklist
Type of Change
Testing
Manual testing instructions
If feature requires manual testing by reviewer, you can provide instructions here.Internationalization & Accessibility
Integrations (if applicable)
If there are model changes to models which use any of the features below, verify the new models work together with the features.
For example, when adding a new model, verify the new model instances are copied when copying a plan.
Dependencies