about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAsh Furrow <ash@ashfurrow.com>2017-04-10 18:13:08 -0400
committerwxcafé <wxcafe@users.noreply.github.com>2017-04-11 00:13:08 +0200
commitd439855a6d04ff04a187b4a1ded03c6ee2bc062e (patch)
treef1b4bd0f3157fbf628e2528eb12d428469d4673f
parent2810013b933bceb2a7c1d1b8b10d2714c39d1e15 (diff)
Adds error message to mastodon:confirm_email task. (#1476)
-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