mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 23:13:33 +00:00
Add DomainBlock#accounts has_many
This commit is contained in:
parent
93084845b5
commit
0a82d959a5
|
@ -7,6 +7,9 @@ class DomainBlock < ApplicationRecord
|
|||
|
||||
validates :domain, presence: true, uniqueness: true
|
||||
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
delegate :count, to: :accounts, prefix: true
|
||||
|
||||
def self.blocked?(domain)
|
||||
where(domain: domain, severity: :suspend).exists?
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
label: t(".retroactive.#{@domain_block.severity}"),
|
||||
hint: t(:affected_accounts,
|
||||
scope: [:admin, :domain_blocks, :show],
|
||||
count: Account.where(domain: @domain_block.domain).count)
|
||||
count: @domain_block.accounts_count)
|
||||
|
||||
.actions
|
||||
= f.button :button, t('.undo'), type: :submit
|
||||
|
|
Loading…
Reference in a new issue