]> cat aescling's git repositories - mastodon.git/commitdiff
Adds error message to mastodon:confirm_email task. (#1476)
authorAsh Furrow <ash@ashfurrow.com>
Mon, 10 Apr 2017 22:13:08 +0000 (18:13 -0400)
committerwxcafé <wxcafe@users.noreply.github.com>
Mon, 10 Apr 2017 22:13:08 +0000 (00:13 +0200)
lib/tasks/mastodon.rake

index 5dc7f15678f7ccebf6ba53b361f6ad322c568bbc..037a133986f396e2fffb949730eac77489c6e279 100644 (file)
@@ -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