From f99b24cc5d96e6598469ffb33be8c50b49670117 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 19 Nov 2024 09:38:51 -0500 Subject: [PATCH] Move `Account#domain_blocks` declaration from interactions->associations --- app/models/account_domain_block.rb | 3 ++- app/models/concerns/account/associations.rb | 1 + app/models/concerns/account/interactions.rb | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/account_domain_block.rb b/app/models/account_domain_block.rb index 753935d6af..c555678ec7 100644 --- a/app/models/account_domain_block.rb +++ b/app/models/account_domain_block.rb @@ -15,7 +15,8 @@ class AccountDomainBlock < ApplicationRecord include Paginable include DomainNormalizable - belongs_to :account + belongs_to :account, inverse_of: :domain_blocks + validates :domain, presence: true, uniqueness: { scope: :account_id }, domain: true after_commit :invalidate_domain_blocking_cache diff --git a/app/models/concerns/account/associations.rb b/app/models/concerns/account/associations.rb index cafb2d151c..b90a772186 100644 --- a/app/models/concerns/account/associations.rb +++ b/app/models/concerns/account/associations.rb @@ -15,6 +15,7 @@ module Account::Associations has_many :bookmarks has_many :conversations, class_name: 'AccountConversation' has_many :custom_filters + has_many :domain_blocks, class_name: 'AccountDomainBlock' has_many :favourites has_many :featured_tags, -> { includes(:tag) } has_many :list_accounts diff --git a/app/models/concerns/account/interactions.rb b/app/models/concerns/account/interactions.rb index 6f6b8c16d0..79d1807352 100644 --- a/app/models/concerns/account/interactions.rb +++ b/app/models/concerns/account/interactions.rb @@ -107,7 +107,6 @@ module Account::Interactions has_many :muting, -> { order(mutes: { id: :desc }) }, through: :mute_relationships, source: :target_account has_many :muted_by, -> { order(mutes: { id: :desc }) }, through: :muted_by_relationships, source: :account has_many :conversation_mutes, dependent: :destroy - has_many :domain_blocks, class_name: 'AccountDomainBlock', dependent: :destroy has_many :announcement_mutes, dependent: :destroy end