From d439855a6d04ff04a187b4a1ded03c6ee2bc062e Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Mon, 10 Apr 2017 18:13:08 -0400 Subject: [PATCH] Adds error message to mastodon:confirm_email task. (#1476) --- lib/tasks/mastodon.rake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 5dc7f156..037a1339 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