Skip to content

Commit

Permalink
Merge pull request #2091 from rubygems/blocked-user-info
Browse files Browse the repository at this point in the history
Print blocked user info before blocking
  • Loading branch information
indirect committed Aug 15, 2019
2 parents f71d22d + 77a2af8 commit 59714fd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions script/block_user
@@ -1,19 +1,21 @@
#!/usr/bin/env ruby

if ARGV.empty?
puts "Locks a user account so it can't be used."
puts "Blocks a user account so it can't be used."
puts "USAGE: script/block_user USERNAME"
exit
end

handle = ARGV.first
puts "Locking user #{handle}..."
puts "Blocking user #{handle}..."

ENV["RAILS_ENV"] ||= "production"
require_relative "../config/environment"

begin
User.find_by!(handle: handle).block!
user = User.find_by!(handle: handle)
puts "Found user: #{user}"
user.block!
puts "Done."
rescue ActiveRecord::RecordNotFound
puts "User #{handle} not found."
Expand Down

0 comments on commit 59714fd

Please sign in to comment.