Skip to content

Commit e3a6ab7

Browse files
iHiDclaude
andauthored
Remove Sparkpost email validation in favor of SES Auto Validation (#8826)
* Remove Sparkpost email validation in favor of SES Auto Validation SES Auto Validation now handles email address validation at the infrastructure level before delivery, making the app-level Sparkpost recipient validation redundant. This removes the VerifyEmail command, its call sites (bootstrap + email change), and the email_status_invalid gate from may_receive_emails?. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Restore email_status_invalid gate and add tests for unverified Keep blocking emails to addresses previously marked invalid by Sparkpost, but allow sending to unverified addresses (which all new users will now have since we no longer proactively validate). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent add086b commit e3a6ab7

File tree

6 files changed

+9
-118
lines changed

6 files changed

+9
-118
lines changed

app/commands/user/bootstrap.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ def call
77
user.auth_tokens.create!
88
AwardBadgeJob.perform_later(user, :member)
99
Metric::Queue.(:sign_up, user.created_at, user:)
10-
User::VerifyEmail.defer(user)
1110

1211
link_courses!
1312
end

app/commands/user/verify_email.rb

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/models/user.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,6 @@ class User < ApplicationRecord
174174
after_confirmation if confirmed?
175175
end
176176

177-
after_update_commit do
178-
reverify_email! if previous_changes.key?('email')
179-
end
180-
181177
# If we don't know about this record, maybe the
182178
# user's data record has it instead?
183179
def method_missing(name, *args)
@@ -339,11 +335,6 @@ def send_devise_notification(notification, *args)
339335
devise_mailer.send(notification, self, *args).deliver_later
340336
end
341337

342-
def reverify_email!
343-
email_status_unverified!
344-
User::VerifyEmail.defer(self)
345-
end
346-
347338
memoize
348339
def bought_course?
349340
course_enrollments.paid.exists?

test/commands/user/bootstrap_test.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ class User::BootstrapTest < ActiveSupport::TestCase
3131
assert_equal user, metric.user
3232
end
3333

34-
test "email verified for new user" do
35-
user = create :user
36-
37-
User::VerifyEmail.expects(:defer).with(user).once
38-
User::Bootstrap.(user)
39-
end
40-
4134
test "becomes attendee and subscribes to onboarding emails if paid email" do
4235
enrollment = create :course_enrollment, :coding_fundamentals, :paid
4336
user = create :user, email: enrollment.email

test/commands/user/verify_email_test.rb

Lines changed: 0 additions & 54 deletions
This file was deleted.

test/models/user_test.rb

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,6 @@ class UserTest < ActiveSupport::TestCase
409409
assert_equal :insider, user.flair
410410
end
411411

412-
test "email verified when email changes" do
413-
user = create :user
414-
415-
User::VerifyEmail.expects(:defer).with(user).once
416-
417-
user.email = 'test@example.org'
418-
user.skip_reconfirmation!
419-
user.save!
420-
end
421-
422412
test "asset may receive email by default" do
423413
user = create :user
424414
assert user.may_receive_emails?
@@ -434,12 +424,18 @@ class UserTest < ActiveSupport::TestCase
434424
refute user.may_receive_emails?
435425
end
436426

437-
test "refute may receive email for invalid email" do
438-
user = create :user, disabled_at: Time.current
439-
user.email_status_invalid!
427+
test "refute may receive email for invalid email status" do
428+
user = create :user
429+
user.data.update!(email_status: :invalid)
440430
refute user.may_receive_emails?
441431
end
442432

433+
test "assert may receive email for unverified email status" do
434+
user = create :user
435+
user.data.update!(email_status: :unverified)
436+
assert user.may_receive_emails?
437+
end
438+
443439
test "refute may receive email for ghost user" do
444440
user = create :user, :ghost
445441
refute user.may_receive_emails?

0 commit comments

Comments
 (0)