From 61402a29a2c81e5a8400826854f1ca77a98e920b Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:14:23 -0600 Subject: [PATCH] Updated domains cli remoteallremote command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - domains cli remoteallremote command --- lib/gabsocial/domains_cli.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index 16ba5654..7fa227cb 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -44,19 +44,23 @@ module GabSocial def deleteallremote dry_run = options[:dry_run] ? ' (DRY RUN)' : '' - Account.remote.by_domain_accounts.limit(2).each do |domain| + Account.remote.by_domain_accounts.each do |acct| + domain = acct.domain + say("Starting domain block for #{domain} #{dry_run}", :green) - existing_domain_block = DomainBlock.find_by(domain: domain) + if domain.present? + 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) + 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 - else - say("Domain block for #{domain} is already implemented #{dry_run}", :green) end end