Module: Devise::Models::DecidimNewsletterable

Defined in:
lib/devise/models/decidim_newsletterable.rb

Overview

Newsletterable adds all needed validations to accomplish GDPR standards in newsletter notification mailing

Validates that all users with notifications activated have Opt-in in some time

Constant Summary collapse

GDPR_DATE =
"2018-05-25 00:00 +02:00"

Instance Method Summary collapse

Instance Method Details

#newsletter_opt_in_notifyObject



13
14
15
16
17
18
# File 'lib/devise/models/decidim_newsletterable.rb', line 13

def newsletter_opt_in_notify
  unless newsletter_opt_in_valid?
    set_newsletter_token!
    Decidim::NewslettersOptInJob.perform_later(self, newsletter_token)
  end
end

#newsletter_opt_in_validateObject



20
21
22
# File 'lib/devise/models/decidim_newsletterable.rb', line 20

def newsletter_opt_in_validate
  set_newsletter_opt_in! if newsletter_notifications_at.blank?
end