Reattribute notification-related records if possible when merging accounts (#29694)
This commit is contained in:
parent
de6c9e0fcd
commit
d71d26a3c9
2 changed files with 25 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue