diff --git a/app/models/concerns/account/interactions.rb b/app/models/concerns/account/interactions.rb index 6f6b8c16d0..6e2dc9126c 100644 --- a/app/models/concerns/account/interactions.rb +++ b/app/models/concerns/account/interactions.rb @@ -88,6 +88,9 @@ module Account::Interactions has_many :remote_severed_relationships, foreign_key: 'remote_account_id', inverse_of: :remote_account end + # 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 bd8b162238..181061c37e 100644 --- a/app/models/concerns/account/merging.rb +++ b/app/models/concerns/account/merging.rb @@ -16,7 +16,7 @@ module Account::Merging 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 0c03267d43..7d06302af5 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -50,6 +50,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 0b84047a1c..532fbc328a 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -43,6 +43,7 @@ module Mastodon::CLI class BulkImport < ApplicationRecord; end class SoftwareUpdate < ApplicationRecord; end class SeveredRelationship < ApplicationRecord; end + class TagFollow < ApplicationRecord; end class DomainBlock < ApplicationRecord enum :severity, { silence: 0, suspend: 1, noop: 2 } @@ -102,6 +103,7 @@ module Mastodon::CLI owned_classes << AccountIdentityProof if db_table_exists?(:account_identity_proofs) owned_classes << Appeal if db_table_exists?(:appeals) owned_classes << BulkImport if db_table_exists?(:bulk_imports) + owned_classes << TagFollow if db_table_exists?(:tag_follows) owned_classes.each do |klass| klass.where(account_id: other_account.id).find_each do |record|