Skip to content

Implement Draft SentEmail - #4785

Merged
marcoacierno merged 14 commits into
mainfrom
draft-emails
Aug 15, 2026
Merged

Implement Draft SentEmail#4785
marcoacierno merged 14 commits into
mainfrom
draft-emails

Conversation

@marcoacierno

@marcoacierno marcoacierno commented Aug 15, 2026

Copy link
Copy Markdown
Member

What

Add support for drafting emails and manually sending them at a later date

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pycon Ready Ready Preview Aug 15, 2026 4:12pm

@claude

claude Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Adds a draft status for SentEmail and a new admin action (send_email) that transitions draft/pending/failed emails to pending and queues them via Celery, so admins can compose an email now and manually trigger sending later.

  • SentEmailAdmin.send_email is registered in actions as a plain method with no allowed_permissions, so Django exposes it to any staff user with just view_sentemail permission — it doesn't require change permission. That's inconsistent with this same admin explicitly disabling has_add_permission/has_change_permission to keep SentEmail records read-only; the action bypasses that intent since it mutates status and triggers real outbound email sends. Consider gating it with action.allowed_permissions = ("change",) (or a custom permission check), or if has_change_permission staying False is intentional, use a different permission name to distinguish "can send" from "can edit".
  • admins.py:send_email calls self.message_user(request, f"Emails queued for sending: {len(affected_emails_ids)}") before _submit_emails_for_sending runs (it's registered via transaction.on_commit), and that helper swallows any .delay() exception per email (logging only). If enqueueing fails for one or more emails, the admin still sees "Emails queued for sending: N" with no indication that some of those emails are now stuck in pending with no task actually queued.

@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (ace3c25) to head (5996906).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4785      +/-   ##
==========================================
+ Coverage   93.08%   93.09%   +0.01%     
==========================================
  Files         360      360              
  Lines       11202    11227      +25     
  Branches      902      903       +1     
==========================================
+ Hits        10427    10452      +25     
  Misses        663      663              
  Partials      112      112              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marcoacierno
marcoacierno merged commit 7bb569a into main Aug 15, 2026
9 checks passed
@marcoacierno
marcoacierno deleted the draft-emails branch August 15, 2026 23:08
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.

1 participant