Added new cli commands in emoji, domains for removing remote content

• Added:
- new cli commands in emoji, domains for removing remote content
This commit is contained in:
mgabdev 2020-11-25 16:03:29 -06:00
parent 854e510acc
commit 99e5711c8b
2 changed files with 26 additions and 2 deletions

View File

@ -39,6 +39,30 @@ module GabSocial
say("Removed #{custom_emojis_count} custom emojis", :green)
end
option :dry_run, type: :boolean
desc 'deleteallremote', 'Remove all remote data'
def deleteallremote
dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
Account.remote.by_domain_accounts.limit(2).each do |domain|
say("Starting domain block for #{domain} #{dry_run}", :green)
existing_domain_block = DomainBlock.find_by(domain: domain)
unless existing_domain_block.present?
say("Domain block for #{domain} is starting #{dry_run}", :green)
unless options[:dry_run]
domain_block = DomainBlock.new(domain: domain, severity: :suspend)
DomainBlockWorker.perform_async(@domain_block.id)
end
else
say("Domain block for #{domain} is already implemented #{dry_run}", :green)
end
end
say('Domain block deleteallremote done', :green)
end
option :concurrency, type: :numeric, default: 50, aliases: [:c]
option :silent, type: :boolean, default: false, aliases: [:s]
option :format, type: :string, default: 'summary', aliases: [:f]

View File

@ -66,9 +66,9 @@ module GabSocial
say("Imported #{imported}, skipped #{skipped}, failed to import #{failed}", color(imported, skipped, failed))
end
desc 'purge', 'Remove all custom emoji'
desc 'purge', 'Remove all remote custom emoji'
def purge
CustomEmoji.in_batches.destroy_all
CustomEmoji.remote.in_batches.destroy_all
say('OK', :green)
end