mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 03:28:38 +08:00
DEV: add transaction and active check to invalidate job
Follows up on 3b76f196684a8 this per @tgxworld a transaction makes sense here Very minor
This commit is contained in:
parent
94b8ba4f8f
commit
f74ef71130
@ -8,15 +8,18 @@ module Jobs
|
||||
|
||||
User.human_users
|
||||
.where(admin: true)
|
||||
.where(active: true)
|
||||
.where('last_seen_at < ?', SiteSetting.invalidate_inactive_admin_email_after_days.days.ago)
|
||||
.each do |user|
|
||||
|
||||
user.deactivate
|
||||
user.email_tokens.update_all(confirmed: false, expired: true)
|
||||
User.transaction do
|
||||
user.deactivate
|
||||
user.email_tokens.update_all(confirmed: false, expired: true)
|
||||
|
||||
Discourse.authenticators.each do |authenticator|
|
||||
if authenticator.can_revoke? && authenticator.description_for_user(user).present?
|
||||
authenticator.revoke(user)
|
||||
Discourse.authenticators.each do |authenticator|
|
||||
if authenticator.can_revoke? && authenticator.description_for_user(user).present?
|
||||
authenticator.revoke(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user