Class: Gitlab::BackgroundMigration::WrongfullyConfirmedEmailUnconfirmer
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::WrongfullyConfirmedEmailUnconfirmer
- Defined in:
- lib/gitlab/background_migration/wrongfully_confirmed_email_unconfirmer.rb
Defined Under Namespace
Classes: EmailModel, UserModel
Instance Method Summary collapse
Instance Method Details
#perform(start_id, stop_id) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/gitlab/background_migration/wrongfully_confirmed_email_unconfirmer.rb', line 37 def perform(start_id, stop_id) email_records = EmailModel .wrongfully_confirmed_emails(start_id, stop_id) .to_a user_ids = email_records.map(&:user_id).uniq ActiveRecord::Base.transaction do update_email_records(start_id, stop_id) update_user_records(user_ids) end # Refind the records with the "real" Email model so devise will notice that the user / email is unconfirmed unconfirmed_email_records = ::Email.where(id: email_records.map(&:id)) ActiveRecord::Associations::Preloader.new.preload(unconfirmed_email_records, [:user]) send_emails(unconfirmed_email_records) end |