about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2020-12-19 00:55:12 +0100
committerClaire <claire.github-309c@sitedethib.com>2020-12-19 00:55:12 +0100
commitf9d000ebaec7732d5fcd46aa6685108a2619966b (patch)
tree9593841cf520b117ca4c3d5b68b19e9124c852da /lib
parent92cfcf168cae094ece281b3cb6d0f5b1539a8c25 (diff)
parentc6598b17d9212c2d48395da73fa9529025d704cc (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `app/services/resolve_url_service.rb`:
  The private toot search by URL hack has been revamped upstream.
  Took upstream's version.
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/accounts_cli.rb19
-rw-r--r--lib/mastodon/maintenance_cli.rb2
-rw-r--r--lib/mastodon/version.rb2
3 files changed, 21 insertions, 2 deletions
diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb
index bef4093a8..474643869 100644
--- a/lib/mastodon/accounts_cli.rb
+++ b/lib/mastodon/accounts_cli.rb
@@ -236,6 +236,25 @@ module Mastodon
       say('OK', :green)
     end
 
+    desc 'fix-duplicates', 'Find duplicate remote accounts and merge them'
+    option :dry_run, type: :boolean
+    long_desc <<-LONG_DESC
+      Merge known remote accounts sharing an ActivityPub actor identifier.
+
+      Such duplicates can occur when a remote server admin misconfigures their
+      domain configuration.
+    LONG_DESC
+    def fix_duplicates
+      Account.remote.select(:uri, 'count(*)').group(:uri).having('count(*) > 1').pluck_each(:uri) do |uri|
+        say("Duplicates found for #{uri}")
+        begin
+          ActivityPub::FetchRemotAccountService.new.call(uri) unless options[:dry_run]
+        rescue => e
+          say("Error processing #{uri}: #{e}", :red)
+        end
+      end
+    end
+
     desc 'backup USERNAME', 'Request a backup for a user'
     long_desc <<-LONG_DESC
       Request a new backup for an account with a given USERNAME.
diff --git a/lib/mastodon/maintenance_cli.rb b/lib/mastodon/maintenance_cli.rb
index ffad3f6a2..822051ceb 100644
--- a/lib/mastodon/maintenance_cli.rb
+++ b/lib/mastodon/maintenance_cli.rb
@@ -14,7 +14,7 @@ module Mastodon
     end
 
     MIN_SUPPORTED_VERSION = 2019_10_01_213028
-    MAX_SUPPORTED_VERSION = 2020_12_06_004238
+    MAX_SUPPORTED_VERSION = 2020_12_18_054746
 
     # Stubs to enjoy ActiveRecord queries while not depending on a particular
     # version of the code/database
diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb
index 84f7f1961..c1586a09f 100644
--- a/lib/mastodon/version.rb
+++ b/lib/mastodon/version.rb
@@ -17,7 +17,7 @@ module Mastodon
     end
 
     def flags
-      'rc1'
+      'rc2'
     end
 
     def suffix