From 2f2b84bfbbfa21a09e03dca05e159aadb70d2232 Mon Sep 17 00:00:00 2001 From: d0p1 Date: Tue, 11 Apr 2017 22:51:17 +0200 Subject: [PATCH] Add task in order to delete unconfirmed users (older than 2days) (#1571) * add task in order to delete unconfirmed user * change 7 days to 2 --- lib/tasks/mastodon.rake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index a8fb58b7fe..4761b2919c 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -75,6 +75,13 @@ namespace :mastodon do end end + namespace :users do + desc 'clear unconfirmed users' + task clear: :environment do + User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).find_each(&:destroy) + end + end + namespace :maintenance do desc 'Update counter caches' task update_counter_caches: :environment do