mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:19:52 +01:00
Add Rake task for removing stale users
This commit is contained in:
parent
aad91d4c09
commit
00d9688299
1 changed files with 9 additions and 0 deletions
9
Rakefile
9
Rakefile
|
@ -238,6 +238,15 @@ namespace :justask do
|
|||
end
|
||||
end
|
||||
|
||||
desc "Removes users whose accounts haven't been verified for over 3 months."
|
||||
task remove_stale: :environment do
|
||||
puts "Removing stale users…"
|
||||
removed = User.where(confirmed_at: nil)
|
||||
.where("confirmation_sent_at < ?", DateTime.now.utc - 3.months)
|
||||
.destroy_all.count
|
||||
puts "Removed #{removed} users"
|
||||
end
|
||||
|
||||
desc "Fixes the notifications"
|
||||
task fix_notifications: :environment do
|
||||
format = '%t (%c/%C) [%b>%i] %e'
|
||||
|
|
Loading…
Reference in a new issue