about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/mastodon.rake11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 5dc7f1567..037a13398 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -13,10 +13,13 @@ namespace :mastodon do
   desc 'Manually confirms a user with associated user email address stored in USER_EMAIL environment variable.'
   task confirm_email: :environment do
     email = ENV.fetch('USER_EMAIL')
-    user = User.where(email: email)
-    user.update(confirmed_at: Time.now.utc)
-
-    puts "User #{email} confirmed."
+    user = User.where(email: email).first
+    if user
+      user.update(confirmed_at: Time.now.utc)
+      puts "User #{email} confirmed."
+    else
+      abort "User #{email} not found."
+    end
   end
 
   namespace :media do