Fix/bulk send file attachments missing - #2958
Open
whabanks wants to merge 15 commits into
Open
Conversation
Fixed an issue where bulk jobs were not fetching template attachment metadata prior to sending. This fixes two issues: 1. Files weren't attached to email notifications when sent 2. Metadata wasn't available for the front end to display file attachment names when viewing notification history from the dashboard
When performing a one-off send, admin attaches file metadata to the notification's personalisation before calling API. This change ensures that the same occurs for notifications sent during a bulk job. Because the job CSV only contained user-provided columns, we weren't writing the template attachment metadata into each notification's personalisation, resulting in the history page failing to display attachments for notifications belonging to a job - Added `_persist_template_attachment_metadata` to `send_to_providers` where it is called during `send_email_to_provider` to update the personalisation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes bulk-job email notifications missing template attachment metadata in notification.personalisation, which breaks attachment display on the notification history page.
Changes:
- Adds
file_sizeto cached/DB template-file metadata used during bulk sends. - Introduces
_persist_template_attachment_metadataand calls it fromsend_email_to_providerto populate_file_Npersonalisation entries for bulk notifications. - Adds tests covering persistence behavior and integration with
send_email_to_provider.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
app/delivery/send_to_providers.py |
Adds file_size to template file metadata, introduces metadata persistence helper, and calls it during email send flow. |
app/celery/tasks.py |
Includes file_size when pre-caching template file metadata for jobs. |
tests/app/delivery/test_template_attachments.py |
Adds unit + integration tests for persisting template attachment metadata into notification personalisation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixed some tests
andrewleith
approved these changes
Jul 23, 2026
andrewleith
left a comment
Member
There was a problem hiding this comment.
LGTM - I can see the attachment list on a bulk notification history page now!
jzbahrai
enabled auto-merge (squash)
August 11, 2026 15:23
jzbahrai
disabled auto-merge
August 11, 2026 15:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary | Résumé
This PR fixes an issue where file attachment metadata was not persisted to notification.personalisation for notifications belonging to a job.
When performing a one-off send, admin attaches file metadata to the notification's personalisation before calling API. This change ensures that the same occurs for notifications sent during a bulk job. Because the job CSV only contained user provided columns, we weren't writing the template attachment metadata into each notification's personalisation, resulting in the notification history page failing to display attachment metadata for notifications belonging to a job.
_persist_template_attachment_metadatatosend_to_providers.py.send_email_to_providercalls to update the personalisation dict prior to persisting the status ->sendingupdate to the db. This method will only add to metadata if it does not yet exist and thus should not affect the one-off sending flow.file_sizeto the Redis cache key for job attachments.Related Issues | Cartes liées
Test instructions | Instructions pour tester la modification
Release Instructions | Instructions pour le déploiement
None.
Reviewer checklist | Liste de vérification du réviseur