diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb index add2444138..4c2fd8fa5d 100644 --- a/app/models/concerns/account_interactions.rb +++ b/app/models/concerns/account_interactions.rb @@ -83,6 +83,9 @@ module AccountInteractions has_many :following, -> { order('follows.id desc') }, through: :active_relationships, source: :target_account has_many :followers, -> { order('follows.id desc') }, through: :passive_relationships, source: :account + # Hashtag follows + has_many :tag_follows, inverse_of: :account, dependent: :destroy + # Account notes has_many :account_notes, dependent: :destroy diff --git a/app/models/concerns/account_merging.rb b/app/models/concerns/account_merging.rb index 14e157a3d8..1f0940f37f 100644 --- a/app/models/concerns/account_merging.rb +++ b/app/models/concerns/account_merging.rb @@ -16,7 +16,7 @@ module AccountMerging Follow, FollowRequest, Block, Mute, AccountModerationNote, AccountPin, AccountStat, ListAccount, PollVote, Mention, AccountDeletionRequest, AccountNote, FollowRecommendationSuppression, - Appeal + Appeal, TagFollow ] owned_classes.each do |klass| diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 190a72e5c5..2e196333a2 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -52,6 +52,7 @@ class DeleteAccountService < BaseService owned_lists scheduled_statuses status_pins + tag_follows ) ASSOCIATIONS_ON_DESTROY = %w( diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index c2a6802e1d..14f75ece86 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -39,6 +39,7 @@ module Mastodon::CLI class Webhook < ApplicationRecord; end class BulkImport < ApplicationRecord; end class SoftwareUpdate < ApplicationRecord; end + class TagFollow < ApplicationRecord; end class PreviewCard < ApplicationRecord self.inheritance_column = false @@ -89,6 +90,7 @@ module Mastodon::CLI owned_classes << AccountIdentityProof if ActiveRecord::Base.connection.table_exists?(:account_identity_proofs) owned_classes << Appeal if ActiveRecord::Base.connection.table_exists?(:appeals) owned_classes << BulkImport if ActiveRecord::Base.connection.table_exists?(:bulk_imports) + owned_classes << TagFollow if ActiveRecord::Base.connection.table_exists?(:tag_follows) owned_classes.each do |klass| klass.where(account_id: other_account.id).find_each do |record|