whisper-money/app/Mail/Drip
Víctor Falcón eea929ef9d refactor(drip): extract base mailable and job for the drip email family
The eight drip emails and their eight send jobs were near copy-paste. Every
mailable repeated the same constructor, $tries/$backoff, drip_from envelope,
markdown+userName content and RateLimited middleware, differing only in subject
and template (plus a reply-to on one and an extra view var on another). Every job
repeated the canReceiveEmails/hasReceivedEmail guards, the Mail::send call and the
UserMailLog::create block, differing only in the email type, the mailable, and a
handful of per-email eligibility checks.

Introduce two abstract bases:

- DripMail owns the shared mailable shape; subclasses declare dripSubject() and
  template(), with optional contentData() (PromoCode's promo code) and
  repliesToSender() (PaywallFollowUp) hooks.
- SendDripEmailJob owns the shared handle() flow; subclasses declare emailType()
  and buildMail(), with an optional shouldSend() hook for the per-email
  eligibility rules (pro-plan, onboarding, transactions, AI consent, ...).

Each mailable drops from ~68 to ~13 lines and each job from ~48 to ~18, with the
shared send/log logic now living in one place.

Behavior unchanged: subjects, from/reply-to, queue, rate limiting, templates,
view data and every eligibility guard are preserved. Full suite green
(1868 passing, 0 failing) and drip job/command/listener tests pass (71/71).
2026-07-04 20:28:20 +02:00
..
AiConsentFollowUpEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
DripMail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
FeedbackEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
ImportHelpEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
OnboardingReminderEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
PaywallFollowUpEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
PromoCodeEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
SubscriptionCancelledEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00
WelcomeEmail.php refactor(drip): extract base mailable and job for the drip email family 2026-07-04 20:28:20 +02:00