Fix owned account notes not being deleted when an account is deleted (#16579)
* Add account_notes relationship * Add tests * Fix owned account notes not being deleted when an account is deleted * Add post-migration to clean up orphaned account notes
This commit is contained in:
parent
818e0b314f
commit
763ab0c7eb
5 changed files with 31 additions and 2 deletions
|
@ -81,6 +81,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
|
||||
|
||||
# Account notes
|
||||
has_many :account_notes, dependent: :destroy
|
||||
|
||||
# Block relationships
|
||||
has_many :block_relationships, class_name: 'Block', foreign_key: 'account_id', dependent: :destroy
|
||||
has_many :blocking, -> { order('blocks.id desc') }, through: :block_relationships, source: :target_account
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue