Skip to content

Commit

Permalink
CV2-2357: set default value for last_received_terms_email_at (#1851)
Browse files Browse the repository at this point in the history
* CV2-2357: set default value for last_received_terms_email_at

* CV2-2357: fix migration
  • Loading branch information
melsawy committed Apr 4, 2024
1 parent b2b6ecf commit 09104d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/concerns/user_private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def skip_confirmation_for_non_email_provider
self.skip_confirmation! if self.from_omniauth_login && self.skip_confirmation_mail.nil?
end

def set_last_received_terms_email_at
self.last_received_terms_email_at = Time.now if self.respond_to?(:last_received_terms_email_at) && self.last_received_terms_email_at.nil?
end

def set_blank_email_for_unconfirmed_user
self.update_columns(email: '') unless self.unconfirmed_email.blank?
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ToSOrPrivacyPolicyReadError < StandardError; end
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
:omniauthable, :lockable, omniauth_providers: [:twitter, :facebook, :slack, :google_oauth2]

before_create :skip_confirmation_for_non_email_provider
before_create :skip_confirmation_for_non_email_provider, :set_last_received_terms_email_at
after_create :create_source_and_account, :set_source_image, :send_welcome_email
before_save :set_token, :set_login
after_update :set_blank_email_for_unconfirmed_user
Expand Down

0 comments on commit 09104d4

Please sign in to comment.