This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve account suspension speed and completeness (mastodon#9290)
- Some associations were missing from the clean-up - Some attributes were not reset on suspension - Skip federation and streaming deletes when purging a dead domain - Move account association definitions to concern
- Loading branch information
Showing
6 changed files
with
153 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccountAssociations | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
# Local users | ||
has_one :user, inverse_of: :account, dependent: :destroy | ||
|
||
# Timelines | ||
has_many :stream_entries, inverse_of: :account, dependent: :destroy | ||
has_many :statuses, inverse_of: :account, dependent: :destroy | ||
has_many :favourites, inverse_of: :account, dependent: :destroy | ||
has_many :mentions, inverse_of: :account, dependent: :destroy | ||
has_many :notifications, inverse_of: :account, dependent: :destroy | ||
has_many :conversations, class_name: 'AccountConversation', dependent: :destroy, inverse_of: :account | ||
|
||
# Pinned statuses | ||
has_many :status_pins, inverse_of: :account, dependent: :destroy | ||
has_many :pinned_statuses, -> { reorder('status_pins.created_at DESC') }, through: :status_pins, class_name: 'Status', source: :status | ||
|
||
# Endorsements | ||
has_many :account_pins, inverse_of: :account, dependent: :destroy | ||
has_many :endorsed_accounts, through: :account_pins, class_name: 'Account', source: :target_account | ||
|
||
# Media | ||
has_many :media_attachments, dependent: :destroy | ||
|
||
# PuSH subscriptions | ||
has_many :subscriptions, dependent: :destroy | ||
|
||
# Report relationships | ||
has_many :reports, dependent: :destroy, inverse_of: :account | ||
has_many :targeted_reports, class_name: 'Report', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account | ||
|
||
has_many :report_notes, dependent: :destroy | ||
has_many :custom_filters, inverse_of: :account, dependent: :destroy | ||
|
||
# Moderation notes | ||
has_many :account_moderation_notes, dependent: :destroy, inverse_of: :account | ||
has_many :targeted_moderation_notes, class_name: 'AccountModerationNote', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account | ||
|
||
# Lists (that the account is on, not owned by the account) | ||
has_many :list_accounts, inverse_of: :account, dependent: :destroy | ||
has_many :lists, through: :list_accounts | ||
|
||
# Lists (owned by the account) | ||
has_many :owned_lists, class_name: 'List', dependent: :destroy, inverse_of: :account | ||
|
||
# Account migrations | ||
belongs_to :moved_to_account, class_name: 'Account', optional: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters