about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-22 17:51:38 +0200
committerThibaut Girka <thib@sitedethib.com>2018-10-22 17:51:38 +0200
commitdcded13a996e1b6b87444641eed66fc2d117e1af (patch)
tree1be2c25853e7196a38b0bebc13e9f5281a24d908 /lib
parent4739e0f090a04235669ef81fa432ae90bb62f4c4 (diff)
parent4f0bdbaaaf6828d7ee6fd6e6023375b727c0afe5 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- .github/ISSUE_TEMPLATE/bug_report.md
  Took our version.
- CONTRIBUTING.md
  Updated the embedded copy of upstream's version.
- README.md
  Took our version.
- app/policies/status_policy.rb
  Not a real conflict, took code from both.
- app/views/layouts/embedded.html.haml
  Added upstream's changes (dns-prefetch) and fixed
  `%body.embed`
- app/views/settings/preferences/show.html.haml
  Reverted some of upstream changes, as we have a
  page dedicated for flavours and skins.
- config/initializers/content_security_policy.rb
  Kept our version of the CSP.
- config/initializers/doorkeeper.rb
  Not a real conflict, took code from both.
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/accounts_cli.rb16
-rw-r--r--lib/mastodon/feeds_cli.rb5
-rw-r--r--lib/mastodon/version.rb4
3 files changed, 21 insertions, 4 deletions
diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb
index 704cf474b..a32bc9533 100644
--- a/lib/mastodon/accounts_cli.rb
+++ b/lib/mastodon/accounts_cli.rb
@@ -223,7 +223,7 @@ module Mastodon
       dry_run           = options[:dry_run] ? ' (DRY RUN)' : ''
 
       Account.remote.where(protocol: :activitypub).partitioned.find_each do |account|
-        next if account.updated_at >= skip_threshold || account.last_webfingered_at >= skip_threshold
+        next if account.updated_at >= skip_threshold || (account.last_webfingered_at.present? && account.last_webfingered_at >= skip_threshold)
 
         unless dead_servers.include?(account.domain)
           begin
@@ -239,7 +239,7 @@ module Mastodon
           end
         end
 
-        if [404, 410].include?(code) || dead_servers.include?(account.domain)
+        if [404, 410].include?(code)
           unless options[:dry_run]
             SuspendAccountService.new.call(account)
             account.destroy
@@ -252,6 +252,18 @@ module Mastodon
         end
       end
 
+      # Remove dead servers
+      unless dead_servers.empty? || options[:dry_run]
+        dead_servers.each do |domain|
+          Account.where(domain: domain).find_each do |account|
+            SuspendAccountService.new.call(account)
+            account.destroy
+            culled += 1
+            say('.', :green, false)
+          end
+        end
+      end
+
       say
       say("Removed #{culled} accounts (#{dead_servers.size} dead servers)#{dry_run}", :green)
 
diff --git a/lib/mastodon/feeds_cli.rb b/lib/mastodon/feeds_cli.rb
index c3fca723e..cca65cf87 100644
--- a/lib/mastodon/feeds_cli.rb
+++ b/lib/mastodon/feeds_cli.rb
@@ -54,6 +54,11 @@ module Mastodon
       elsif username.present?
         account = Account.find_local(username)
 
+        if account.nil?
+          say("Account #{username} is not found", :red)
+          exit(1)
+        end
+
         if options[:background]
           RegenerationWorker.perform_async(account.id) unless options[:dry_run]
         else
diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb
index fc7fa5aca..b4b88dfdc 100644
--- a/lib/mastodon/version.rb
+++ b/lib/mastodon/version.rb
@@ -9,7 +9,7 @@ module Mastodon
     end
 
     def minor
-      5
+      6
     end
 
     def patch
@@ -21,7 +21,7 @@ module Mastodon
     end
 
     def flags
-      ''
+      'rc1'
     end
 
     def to_a