mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Merge commit 'b3b5bf26d14f809a562244642949826b6a91bade' into glitch-soc/merge-upstream
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@ class AnnualReport::Source
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def eligible?
|
||||
true
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def report_statuses
|
||||
|
||||
@@ -15,6 +15,10 @@ class AnnualReport::TopHashtags < AnnualReport::Source
|
||||
}
|
||||
end
|
||||
|
||||
def eligible?
|
||||
report_statuses.joins(:tags).exists?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def top_hashtags
|
||||
|
||||
@@ -11,6 +11,10 @@ class AnnualReport::TopStatuses < AnnualReport::Source
|
||||
}
|
||||
end
|
||||
|
||||
def eligible?
|
||||
report_statuses.public_visibility.exists?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def status_identifier(status)
|
||||
|
||||
Reference in New Issue
Block a user