#pita
2 Likes
12 Likes
6 Comments
8 Shares
2 Likes
One person like that
2 Comments
#diaspora #spam #troll #ban #podmin
#zlax is such a huge #PITA. Third version of the cleaner script. I hope it won't do innocent victims.I guess it will have to run by cron regularly until hell freezes and Zlax tires.
#!/usr/bin/env ruby
# Load diaspora environment
ENV["RAILS_ENV"] ||= "production"
require_relative "config/environment"
toxic_accounts = Person.find_by_substring('ivan zlax')
toxic_list = toxic_accounts.map { |z| z.diaspora_handle }
toxic_list.append('vm66%@diaspora.ruhrmail.de', 'ivan_exlax@pod.dapor.net ', 'zlax@%', 'zlaxyizlax@%')
puts toxic_list.inspect
#exit
for toxic in toxic_list do
puts "Blocking and cleaning #{toxic}"
local_spammers, remote_spammers = Person.where("diaspora_handle LIKE ?", toxic).where(closed_account: false).partition(&:local?)
# Retract all comments of local spammers and close their accounts
local_spammers.each do |spammer|
Comment.where(author_id: spammer.id).each do |comment|
puts "delete #{comment.guid} from post #{comment.parent.guid}"
spammer.owner.retract(comment)
end
spammer.owner.close_account!
end
# Retract all spam comments on posts of local users and delete the rest
Comment.where(author_id: remote_spammers.map(&:id)).each do |comment|
puts "delete #{comment.guid} from post #{comment.parent.guid}"
post_author = comment.parent.author
if post_author.local?
post_author.owner.retract(comment)
else
comment.destroy
end
end
# Close accounts of remote users if wanted
remote_spammers.each do |spammer|
puts "close account #{spammer.diaspora_handle}"
#AccountDeleter.new(spammer.diaspora_handle).perform!
spammer.update_column(:serialized_public_key, "BLOCKED")
puts "closed account #{spammer.diaspora_handle}"
end
end
One person like that
1 Shares