0
0
Fork 0

Add notifications of severed relationships (#27511)

This commit is contained in:
Claire 2024-03-20 16:37:21 +01:00 committed by GitHub
parent 8a1423a474
commit 44bf7b8128
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 781 additions and 54 deletions

View file

@ -5,7 +5,7 @@ require_relative 'base'
module Mastodon::CLI
class Maintenance < Base
MIN_SUPPORTED_VERSION = 2019_10_01_213028
MAX_SUPPORTED_VERSION = 2023_09_07_150100
MAX_SUPPORTED_VERSION = 2023_10_23_105620
# Stubs to enjoy ActiveRecord queries while not depending on a particular
# version of the code/database
@ -39,6 +39,7 @@ module Mastodon::CLI
class Webhook < ApplicationRecord; end
class BulkImport < ApplicationRecord; end
class SoftwareUpdate < ApplicationRecord; end
class SeveredRelationship < ApplicationRecord; end
class DomainBlock < ApplicationRecord
enum severity: { silence: 0, suspend: 1, noop: 2 }
@ -129,6 +130,20 @@ module Mastodon::CLI
record.update_attribute(:account_warning_id, id)
end
end
if ActiveRecord::Base.connection.table_exists?(:severed_relationships)
SeveredRelationship.where(local_account_id: other_account.id).reorder(nil).find_each do |record|
record.update_attribute(:local_account_id, id)
rescue ActiveRecord::RecordNotUnique
next
end
SeveredRelationship.where(remote_account_id: other_account.id).reorder(nil).find_each do |record|
record.update_attribute(:remote_account_id, id)
rescue ActiveRecord::RecordNotUnique
next
end
end
end
end