Class: SignupsManager

Inherits:
Object
  • Object
show all
Defined in:
lib/signups_manager.rb

Overview

Class with methods related to managing data created when a user signs up.

Class Method Summary collapse

Class Method Details

.destroy_old_signupsObject

Destroy old User records corresponding to users who signed up but never confirmed their email address. This will trigger the destruction of associated records (opml_import_job_state, etc). The interval after which an unconfirmed signup is discarded is configured with the config.discard_unconfirmed_signups_after option in config/application.rb


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/signups_manager.rb', line 24

def self.destroy_old_signups
  signups_older_than = Time.zone.now - Feedbunch::Application.config.discard_unconfirmed_signups_after
  Rails.logger.info "Destroying unconfirmed users signed up before #{signups_older_than}"

  old_unconfirmed_signups = User.
    where 'confirmed_at is null AND confirmation_sent_at < ?',
          signups_older_than

  if old_unconfirmed_signups.empty?
    Rails.logger.info 'No old unconfirmed signups need to be destroyed'
    return
  end
  Rails.logger.info "Destroying #{old_unconfirmed_signups.count} old unconfirmed signups"

  old_unconfirmed_signups.destroy_all
end

.send_confirmation_remindersObject

Send a reminder email to users who signed up but didn't confirm their email. Two reminders are sent, after that the unconfirmed user is destroyed (see destroy_old_signups below). The time after signup that reminders are sent is configured in these config/application.rb values:

  • config.first_confirmation_reminder_after

  • config.second_confirmation_reminder_after


13
14
15
16
# File 'lib/signups_manager.rb', line 13

def self.send_confirmation_reminders
  send_first_confirmation_reminders
  send_second_confirmation_reminders
end