Merge commit 'b3b5bf26d14f809a562244642949826b6a91bade' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2025-12-04 20:16:21 +01:00
149 changed files with 2221 additions and 615 deletions

View File

@@ -18,11 +18,24 @@ class AnnualReport
'annual_report_'
end
def self.current_campaign
return unless Mastodon::Feature.wrapstodon_enabled?
datetime = Time.now.utc
datetime.year if datetime.month == 12 && (10..31).cover?(datetime.day)
end
def initialize(account, year)
@account = account
@year = year
end
def eligible?
with_read_replica do
SOURCES.all? { |klass| klass.new(@account, @year).eligible? }
end
end
def generate
return if GeneratedAnnualReport.exists?(account: @account, year: @year)
@@ -30,7 +43,8 @@ class AnnualReport
account: @account,
year: @year,
schema_version: SCHEMA,
data: data
data: data,
share_key: SecureRandom.hex(8)
)
end

View File

@@ -12,6 +12,10 @@ class AnnualReport::Source
raise NotImplementedError
end
def eligible?
true
end
protected
def report_statuses

View File

@@ -15,6 +15,10 @@ class AnnualReport::TopHashtags < AnnualReport::Source
}
end
def eligible?
report_statuses.joins(:tags).exists?
end
private
def top_hashtags

View File

@@ -11,6 +11,10 @@ class AnnualReport::TopStatuses < AnnualReport::Source
}
end
def eligible?
report_statuses.public_visibility.exists?
end
private
def status_identifier(status)