Skip to content

Commit

Permalink
Show accurate number of accounts that would be affected by unsuspendi…
Browse files Browse the repository at this point in the history
…ng an instance
  • Loading branch information
ClearlyClaire committed May 11, 2019
1 parent 9d7801f commit 474bbfd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/models/domain_block.rb
Expand Up @@ -36,4 +36,9 @@ def stricter_than?(other_block)
return false if other_block.silence? && noop?
(reject_media || !other_block.reject_media) && (reject_reports || !other_block.reject_reports)
end

def affected_accounts_count
scope = suspend? ? accounts.where(suspended: true, suspended_at: [created_at, nil]) : accounts.where(silenced: true, silenced_at: [created_at, nil])
scope.count
end
end
2 changes: 1 addition & 1 deletion app/views/admin/domain_blocks/show.html.haml
Expand Up @@ -14,7 +14,7 @@
label: t(".retroactive.#{@domain_block.severity}"),
hint: t(:affected_accounts,
scope: [:admin, :domain_blocks, :show],
count: @domain_block.accounts_count)
count: @domain_block.affected_accounts_count)

.actions
= f.button :button, t('.undo'), type: :submit
4 changes: 2 additions & 2 deletions config/locales/en.yml
Expand Up @@ -293,8 +293,8 @@ en:
one: One account in the database affected
other: "%{count} accounts in the database affected"
retroactive:
silence: Unsilence all existing accounts from this domain
suspend: Unsuspend all existing accounts from this domain
silence: Unsilence existing affected accounts from this domain
suspend: Unsuspend existing affected accounts from this domain
title: Undo domain block for %{domain}
undo: Undo
undo: Undo domain block
Expand Down

0 comments on commit 474bbfd

Please sign in to comment.