Merge remote-tracking branch 'parent/main' into upstream-20240326
This commit is contained in:
commit
6c9b221cb2
263 changed files with 4628 additions and 1518 deletions
|
@ -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
|
||||
|
@ -26,6 +26,9 @@ module Mastodon::CLI
|
|||
class ListAccount < ApplicationRecord; end
|
||||
class PollVote < ApplicationRecord; end
|
||||
class Mention < ApplicationRecord; end
|
||||
class Notification < ApplicationRecord; end
|
||||
class NotificationPermission < ApplicationRecord; end
|
||||
class NotificationRequest < ApplicationRecord; end
|
||||
class AccountDomainBlock < ApplicationRecord; end
|
||||
class AnnouncementReaction < ApplicationRecord; end
|
||||
class FeaturedTag < ApplicationRecord; end
|
||||
|
@ -39,9 +42,10 @@ 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 }
|
||||
enum :severity, { silence: 0, suspend: 1, noop: 2 }
|
||||
scope :by_severity, -> { in_order_of(:severity, %w(noop silence suspend)).order(:domain) }
|
||||
end
|
||||
|
||||
|
@ -107,6 +111,18 @@ module Mastodon::CLI
|
|||
end
|
||||
end
|
||||
|
||||
from_classes = [Notification]
|
||||
from_classes << NotificationPermission if db_table_exists?(:notification_permissions)
|
||||
from_classes << NotificationRequest if db_table_exists?(:notification_requests)
|
||||
|
||||
from_classes.each do |klass|
|
||||
klass.where(from_account_id: other_account.id).find_each do |record|
|
||||
record.update_attribute(:from_account_id, id)
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
target_classes = [Follow, FollowRequest, Block, Mute, AccountModerationNote, AccountPin]
|
||||
target_classes << AccountNote if db_table_exists?(:account_notes)
|
||||
|
||||
|
@ -129,6 +145,20 @@ module Mastodon::CLI
|
|||
record.update_attribute(:account_warning_id, id)
|
||||
end
|
||||
end
|
||||
|
||||
if db_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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue