Skip to content

feat: publish email templates - #31

Merged
shavonn merged 1 commit into
mainfrom
feat/publish-email-templates
Sep 20, 2026
Merged

shavonn merged 1 commit into
mainfrom
feat/publish-email-templates

Conversation

@shavonn

@shavonn shavonn commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Description

The problem

The two emails a waitlist signup actually receives had their copy written into the notification classes:

  ->subject('Verify Your Email Address')
  ->greeting("Hello {$this->entry->name}!")
  ->line('Please verify your email address to confirm your spot on the waitlist.')

No translations, no views, and the package published only its config and migrations — so a consuming application could change neither the words nor the layout. Both classes are also final, so it could not subclass its way out either. The only escape was replacing the class entirely through config/waitlist.php, which means reimplementing the notification to reword a greeting.

The fix

The copy moves to translations and the layout to markdown views, both publishable:

  php artisan vendor:publish --tag=waitlist-lang    # the words
  php artisan vendor:publish --tag=waitlist-views   # the shape

loadTranslationsFrom() and loadViewsFrom() are registered outside the runningInConsole() guard that wraps the publishes — an application needs them to render mail on a web request, not only when publishing.

Tests

The existing 110 tests fake notifications and assert one was sent, which passes exactly as happily when the view behind it is missing or names an undefined variable. None of this was visible to them.

tests/Feature/NotificationMailTest.php adds three that render:

  • both emails, asserting the name interpolates, the verification token survives into the link, and no waitlist:: key leaked through untranslated
  • both publish tags resolve, with both views registered

@shavonn
shavonn merged commit 9c905f9 into main Sep 20, 2026
20 checks passed
@shavonn
shavonn deleted the feat/publish-email-templates branch September 20, 2026 23:32
@github-actions github-actions Bot mentioned this pull request Sep 20, 2026
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