Email Blacklist - Bulk Delete/Disable Question

After the domains are blacklisted, the accounts that have already made it through are unaffected and can still be used.

I want to ask if anyone knows of a way to bulk destroy (delete user + all of their content), suspend or silence users based on their registration email domain?

In my case this would allow deleting/disabling hundreds of thousands of accounts that used the catchall domain technique to register.

Was this migrated data? Deleting that many accounts is going to be very, very painful – unless they all have almost no content.

You can do it from the rails console, but it does sound like it could be very messy.

@codinghorror - It’s not migrated data. I don’t mind painful and slow as the alternative of allowing the accounts to stay is probably worse :hot_face: For amounts of content, it’s a mix, some have none (usually the spammers intend to use these accounts later), some have minimal, some have heaps.

@pfaffman Great! Do you know how? Haha :pray:

Have you given a thought to anonymizing the users?

@fzngagan 그건 꽤 좋은 해결책일 것 같아요. 일괄 처리하는 방법이 있는지 알고 계신가요?

네. Rails 콘솔에서 수행할 수 있습니다. 하지만 질문은, 어떤 기준으로 익명화할 것인지입니다.

@fzngagan 좋습니다! 기준은 가입 시 이메일 주소에서 특정 도메인을 사용하는 모든 이메일이 될 것입니다. 예: example@blacklisted.com, example2@blacklisted.com

Rails 콘솔에 다음 명령어를 입력하고 예상된 결과가 나오는지 확인해 보세요(이메일 ID 패턴을 '@gmail.com’으로 대체하세요).

idlist = UserEmail.where("email like '%@gmail.com'").pluck(:user_id)
users = User.find(idlist)

그리고 (주의해서 진행하세요)

system_user = Discourse.system_user
users.each do |user|
  UserAnonymizer.new(user, system_user).make_anonymous
end

저는 성능 관련 전문가가 아니므로, 사용자 수가 많을 경우 정확히 어떤 일이 발생할지 모릅니다.

@fzngagan 와, 멋지네요. 정말 감사합니다! :slight_smile: 진심으로 감사드립니다.

이걸 시도하기 전에 모든 것이 최신 상태로 백업되어 있는지 꼭 확인하겠습니다.

간단한 질문인데, 이 기법을 이용해 사용자들을 일괄적으로 (영구적으로) 음소거하는 것이 가능한지 아시나요?

네. Rails 콘솔은 코드에서 실행할 수 있는 대부분의 작업을 수행할 수 있습니다.