Updated user model to call function immediately after_create
• Updated: - user model to call function immediately after_create to welcome, auto follow
This commit is contained in:
parent
84061542f0
commit
4e9d76dda1
@ -98,6 +98,7 @@ class User < ApplicationRecord
|
|||||||
before_validation :sanitize_languages
|
before_validation :sanitize_languages
|
||||||
before_validation :set_unique_email
|
before_validation :set_unique_email
|
||||||
before_create :set_approved
|
before_create :set_approved
|
||||||
|
after_create :prepare_new_user!
|
||||||
|
|
||||||
# This avoids a deprecation warning from Rails 5.1
|
# This avoids a deprecation warning from Rails 5.1
|
||||||
# It seems possible that a future release of devise-two-factor will
|
# It seems possible that a future release of devise-two-factor will
|
||||||
@ -143,7 +144,7 @@ class User < ApplicationRecord
|
|||||||
super
|
super
|
||||||
|
|
||||||
if new_user && approved?
|
if new_user && approved?
|
||||||
prepare_new_user!
|
# prepare_new_user!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -154,7 +155,7 @@ class User < ApplicationRecord
|
|||||||
skip_confirmation!
|
skip_confirmation!
|
||||||
save!
|
save!
|
||||||
|
|
||||||
prepare_new_user! if new_user && approved?
|
# prepare_new_user! if new_user && approved?
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending?
|
def pending?
|
||||||
@ -173,7 +174,7 @@ class User < ApplicationRecord
|
|||||||
return if approved?
|
return if approved?
|
||||||
|
|
||||||
update!(approved: true)
|
update!(approved: true)
|
||||||
prepare_new_user!
|
# prepare_new_user!
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_tracked_fields!(request)
|
def update_tracked_fields!(request)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user