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 def data_source_query
Account Account
.select(:id) .select(:id)
.where(account_domain_sql(params[:include_subdomains])) .where(account_domain_sql)
.where(daily_period(:accounts)) .where(daily_period(:accounts))
end end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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