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
|
@ -83,6 +83,11 @@ module Account::Interactions
|
|||
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
|
||||
|
||||
with_options class_name: 'SeveredRelationship', dependent: :destroy do
|
||||
has_many :severed_relationships, foreign_key: 'local_account_id', inverse_of: :local_account
|
||||
has_many :remote_severed_relationships, foreign_key: 'remote_account_id', inverse_of: :remote_account
|
||||
end
|
||||
|
||||
# Account notes
|
||||
has_many :account_notes, dependent: :destroy
|
||||
|
||||
|
|
|
@ -27,6 +27,16 @@ module Account::Merging
|
|||
end
|
||||
end
|
||||
|
||||
[
|
||||
Notification, NotificationPermission, NotificationRequest
|
||||
].each do |klass|
|
||||
klass.where(from_account_id: other_account.id).reorder(nil).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,
|
||||
AccountNote
|
||||
|
@ -48,6 +58,18 @@ module Account::Merging
|
|||
record.update_attribute(:account_warning_id, id)
|
||||
end
|
||||
|
||||
SeveredRelationship.about_local_account(other_account).reorder(nil).find_each do |record|
|
||||
record.update_attribute(:local_account_id, id)
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
next
|
||||
end
|
||||
|
||||
SeveredRelationship.about_remote_account(other_account).reorder(nil).find_each do |record|
|
||||
record.update_attribute(:remote_account_id, id)
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
next
|
||||
end
|
||||
|
||||
# Some follow relationships have moved, so the cache is stale
|
||||
Rails.cache.delete_matched("followers_hash:#{id}:*")
|
||||
Rails.cache.delete_matched("relationships:#{id}:*")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue