Skip to content
Permalink
Browse files

Merge pull request #2091 from rubygems/blocked-user-info

Print blocked user info before blocking
  • Loading branch information...
indirect committed Aug 15, 2019
2 parents f71d22d + 77a2af8 commit 59714fd376f19009eef8adb00ecb9cf5ab9f1d98
Showing with 5 additions and 3 deletions.
  1. +5 −3 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."

0 comments on commit 59714fd

Please sign in to comment.
You can’t perform that action at this time.