Skip to content

Commit 56863f4

Browse files
simonhampclaude
andcommitted
Skip sending emails to users with unverified email addresses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b69fd86 commit 56863f4

16 files changed

Lines changed: 89 additions & 6 deletions

app/Console/Commands/GrantPluginToBundleOwners.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function handle(): int
4747
->distinct()
4848
->pluck('user_id');
4949

50-
$users = User::whereIn('id', $userIds)->get();
50+
$users = User::whereIn('id', $userIds)->whereNotNull('email_verified_at')->get();
5151

5252
if ($users->isEmpty()) {
5353
$this->warn('No users found who have purchased this bundle.');

app/Console/Commands/ResendNewPluginNotifications.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function handle(): int
3737
}
3838

3939
$recipients = User::query()
40+
->whereNotNull('email_verified_at')
4041
->where('receives_new_plugin_notifications', true)
4142
->whereNotIn('id', $plugins->pluck('user_id'))
4243
->get();

app/Console/Commands/SendLegacyLicenseThankYou.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function handle(): int
4242
foreach ($userLicenses as $userId => $licenses) {
4343
$user = $licenses->first()->user;
4444

45-
if (! $user) {
46-
$this->warn("Skipping license(s) for user ID {$userId} - user not found");
45+
if (! $user || ! $user->email_verified_at) {
46+
$this->warn("Skipping license(s) for user ID {$userId} - user not found or email not verified");
4747
$skipped++;
4848

4949
continue;

app/Console/Commands/SendLicenseExpiryWarnings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private function sendWarningsForDays(int $days, bool $catchUp = false): int
6868
$licenses = $query->get();
6969

7070
foreach ($licenses as $license) {
71-
if ($license->user) {
71+
if ($license->user && $license->user->email_verified_at) {
7272
$license->user->notify(new LicenseExpiryWarning($license, $days));
7373

7474
// Track that we sent this warning

app/Console/Commands/SendMaxToUltraAnnouncement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function handle(): int
2929
]);
3030

3131
$users = User::query()
32+
->whereNotNull('email_verified_at')
3233
->whereHas('subscriptions', function ($query) use ($maxPriceIds) {
3334
$query->where('stripe_status', 'active')
3435
->where('is_comped', false)

app/Console/Commands/SendPluginSubmissionReminders.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function handle(): int
2323
}
2424

2525
$users = User::query()
26+
->whereNotNull('email_verified_at')
2627
->whereHas('plugins', function ($query) {
2728
$query->whereIn('status', [PluginStatus::Draft, PluginStatus::Pending, PluginStatus::Rejected]);
2829
})

app/Console/Commands/SendUltraFreeUserPromotion.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function handle(): int
2222
}
2323

2424
$users = User::query()
25+
->whereNotNull('email_verified_at')
2526
->whereDoesntHave('licenses')
2627
->whereDoesntHave('subscriptions')
2728
->get();

app/Console/Commands/SendUltraLicenseHolderPromotion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function handle(): int
3737
foreach ($userLicenses as $userId => $licenses) {
3838
$user = $licenses->first()->user;
3939

40-
if (! $user) {
40+
if (! $user || ! $user->email_verified_at) {
4141
$skipped++;
4242

4343
continue;

app/Console/Commands/SendUltraUpgradePromotion.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function handle(): int
3636
$eligiblePriceIds = array_merge($miniPriceIds, $proPriceIds);
3737

3838
$users = User::query()
39+
->whereNotNull('email_verified_at')
3940
->whereHas('subscriptions', function ($query) use ($eligiblePriceIds) {
4041
$query->where('stripe_status', 'active')
4142
->where('is_comped', false)

app/Jobs/SendNewPluginNotifications.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function __construct(public Plugin $plugin) {}
1818
public function handle(): void
1919
{
2020
$recipients = User::query()
21+
->whereNotNull('email_verified_at')
2122
->where('receives_new_plugin_notifications', true)
2223
->where('id', '!=', $this->plugin->user_id)
2324
->get();

0 commit comments

Comments
 (0)