1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Remove arg from account domain sql

This commit is contained in:
Matt Jankowski 2024-06-11 11:11:30 -04:00
parent 32849942a1
commit f019cbdadb
7 changed files with 8 additions and 8 deletions

View file

@ -34,7 +34,7 @@ class Admin::Metrics::Measure::InstanceAccountsMeasure < Admin::Metrics::Measure
def data_source_query
Account
.select(:id)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(daily_period(:accounts))
end

View file

@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceFollowersMeasure < Admin::Metrics::Measur
Follow
.select(:id)
.joins(:account)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(daily_period(:follows))
end

View file

@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
Follow
.select(:id)
.joins(:target_account)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(daily_period(:follows))
end

View file

@ -44,7 +44,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
MediaAttachment
.select('COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size')
.joins(:account)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(daily_period(:media_attachments))
end

View file

@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceReportsMeasure < Admin::Metrics::Measure:
Report
.select(:id)
.joins(:target_account)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(daily_period(:reports))
end

View file

@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
Status
.select(:id)
.joins(:account)
.where(account_domain_sql(params[:include_subdomains]))
.where(account_domain_sql)
.where(
<<~SQL.squish
statuses.id BETWEEN :earliest_status_id AND :latest_status_id

View file

@ -39,8 +39,8 @@ module Admin::Metrics::Measure::QueryHelper
SQL
end
def account_domain_sql(include_subdomains)
if include_subdomains
def account_domain_sql
if params[:include_subdomains]
"accounts.domain IN (SELECT domain FROM instances WHERE reverse('.' || domain) LIKE reverse('.' || :domain::text))"
else
'accounts.domain = :domain::text'