Fix TagFollow records not being correctly handled in account operations (#33063)
				
					
				
			This commit is contained in:
		
							parent
							
								
									6cbd217055
								
							
						
					
					
						commit
						6b8ff1cf6e
					
				| @ -88,6 +88,9 @@ module Account::Interactions | |||||||
|       has_many :remote_severed_relationships, foreign_key: 'remote_account_id', inverse_of: :remote_account |       has_many :remote_severed_relationships, foreign_key: 'remote_account_id', inverse_of: :remote_account | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |     # Hashtag follows | ||||||
|  |     has_many :tag_follows, inverse_of: :account, dependent: :destroy | ||||||
|  | 
 | ||||||
|     # Account notes |     # Account notes | ||||||
|     has_many :account_notes, dependent: :destroy |     has_many :account_notes, dependent: :destroy | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ module Account::Merging | |||||||
|       Follow, FollowRequest, Block, Mute, |       Follow, FollowRequest, Block, Mute, | ||||||
|       AccountModerationNote, AccountPin, AccountStat, ListAccount, |       AccountModerationNote, AccountPin, AccountStat, ListAccount, | ||||||
|       PollVote, Mention, AccountDeletionRequest, AccountNote, FollowRecommendationSuppression, |       PollVote, Mention, AccountDeletionRequest, AccountNote, FollowRecommendationSuppression, | ||||||
|       Appeal |       Appeal, TagFollow | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
|     owned_classes.each do |klass| |     owned_classes.each do |klass| | ||||||
|  | |||||||
| @ -50,6 +50,7 @@ class DeleteAccountService < BaseService | |||||||
|     owned_lists |     owned_lists | ||||||
|     scheduled_statuses |     scheduled_statuses | ||||||
|     status_pins |     status_pins | ||||||
|  |     tag_follows | ||||||
|   ) |   ) | ||||||
| 
 | 
 | ||||||
|   ASSOCIATIONS_ON_DESTROY = %w( |   ASSOCIATIONS_ON_DESTROY = %w( | ||||||
|  | |||||||
| @ -43,6 +43,7 @@ module Mastodon::CLI | |||||||
|     class BulkImport < ApplicationRecord; end |     class BulkImport < ApplicationRecord; end | ||||||
|     class SoftwareUpdate < ApplicationRecord; end |     class SoftwareUpdate < ApplicationRecord; end | ||||||
|     class SeveredRelationship < ApplicationRecord; end |     class SeveredRelationship < ApplicationRecord; end | ||||||
|  |     class TagFollow < ApplicationRecord; end | ||||||
| 
 | 
 | ||||||
|     class DomainBlock < ApplicationRecord |     class DomainBlock < ApplicationRecord | ||||||
|       enum :severity, { silence: 0, suspend: 1, noop: 2 } |       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 << AccountIdentityProof if db_table_exists?(:account_identity_proofs) | ||||||
|         owned_classes << Appeal if db_table_exists?(:appeals) |         owned_classes << Appeal if db_table_exists?(:appeals) | ||||||
|         owned_classes << BulkImport if db_table_exists?(:bulk_imports) |         owned_classes << BulkImport if db_table_exists?(:bulk_imports) | ||||||
|  |         owned_classes << TagFollow if db_table_exists?(:tag_follows) | ||||||
| 
 | 
 | ||||||
|         owned_classes.each do |klass| |         owned_classes.each do |klass| | ||||||
|           klass.where(account_id: other_account.id).find_each do |record| |           klass.where(account_id: other_account.id).find_each do |record| | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user