Liste noire des e-mails – Question sur la suppression/désactivation en masse

Une fois les domaines mis sur liste noire, les comptes qui ont déjà été validés restent inchangés et peuvent toujours être utilisés.

Je voudrais savoir si quelqu’un connaît une méthode pour détruire en masse (supprimer l’utilisateur et tout son contenu), suspendre ou mettre en sourdine des utilisateurs en fonction de leur domaine d’adresse e-mail d’inscription ?

Dans mon cas, cela permettrait de supprimer ou de désactiver des centaines de milliers de comptes qui ont utilisé la technique du domaine catch-all pour s’inscrire.

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

1 « J'aime »

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

1 « J'aime »

@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:

1 « J'aime »

Have you given a thought to anonymizing the users?

1 « J'aime »

@fzngagan That might be a solid solution. Know if there a way to do this in bulk?

1 « J'aime »

Yes. It can be done from the rails console. But the question is, on what criteria do you want to anonymize them?

1 « J'aime »

@fzngagan Great! The criteria would be, all emails that use a specific domain in their registration email. E.g. example@blacklisted.com, example2@blacklisted.com

1 « J'aime »

In rails console, type these commands and see if they give expected results(replace you email id pattern with ‘@gmail.com’)

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

then (proceed with caution)

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

I’m not an expert in performance related stuff, so I don’t know exactly what would happen if number of users is big.

2 « J'aime »

@fzngagan Wow nice, thanks heaps! :slight_smile: I really appreciate it.

I’ll make sure everything is recently backed up before giving this a shot.

Quick question, do you know if bulk silencing the users (forever) using this technique is possible?

1 « J'aime »

Yes. Rails console can do mostly everything that can be done from code.

2 « J'aime »