Last active
February 10, 2020 08:35
-
-
Save tribela/09bfdcccbcbb88d538c5f01b3465c404 to your computer and use it in GitHub Desktop.
Find empty account from mastodon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
Account | |
.local.without_suspended | |
.where('accounts.created_at < ?', 30.days.ago) | |
.where(note: '') | |
.where(display_name: '') | |
.where(avatar_file_name: nil) | |
.where( | |
Account.arel_table[:fields].eq(nil).or( | |
Account.arel_table[:fields].eq([]) | |
) | |
) | |
.joins(:account_stat) | |
.where('account_stats.statuses_count': 0) | |
.find_in_batches do |accs| | |
accs.each do |acc| | |
p "#{acc.id} #{acc.username}" | |
# SuspendAccountService.new.call(acc) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I added this to avoid suspending my own server actor.
EDIT: Filtering on the
actor_type
may be useful as well.