Add a confirmation screen when suspending a domain (#25144)
This commit is contained in:
parent
b922ad7a1b
commit
e9385e93e9
20 changed files with 681 additions and 53 deletions
|
@ -16,7 +16,9 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
|
|||
protected
|
||||
|
||||
def perform_total_query
|
||||
Follow.joins(:target_account).merge(Account.where(domain: params[:domain])).count
|
||||
domain = params[:domain]
|
||||
domain = Instance.by_domain_and_subdomains(params[:domain]).select(:domain) if params[:include_subdomains]
|
||||
Follow.joins(:target_account).merge(Account.where(domain: domain)).count
|
||||
end
|
||||
|
||||
def perform_previous_total_query
|
||||
|
@ -24,6 +26,14 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
|
|||
end
|
||||
|
||||
def perform_data_query
|
||||
account_matching_sql = begin
|
||||
if params[:include_subdomains]
|
||||
"accounts.domain IN (SELECT domain FROM instances WHERE reverse('.' || domain) LIKE reverse('.' || $3::text))"
|
||||
else
|
||||
'accounts.domain = $3::text'
|
||||
end
|
||||
end
|
||||
|
||||
sql = <<-SQL.squish
|
||||
SELECT axis.*, (
|
||||
WITH new_follows AS (
|
||||
|
@ -31,7 +41,7 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
|
|||
FROM follows
|
||||
INNER JOIN accounts ON follows.target_account_id = accounts.id
|
||||
WHERE date_trunc('day', follows.created_at)::date = axis.period
|
||||
AND accounts.domain = $3::text
|
||||
AND #{account_matching_sql}
|
||||
)
|
||||
SELECT count(*) FROM new_follows
|
||||
) AS value
|
||||
|
@ -54,6 +64,6 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
|
|||
end
|
||||
|
||||
def params
|
||||
@params.permit(:domain)
|
||||
@params.permit(:domain, :include_subdomains)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue