mirror of
https://github.com/mastodon/mastodon.git
synced 2025-12-11 12:02:41 +00:00
Add method to quickly test for AnnualReport account eligibility (#37045)
This commit is contained in:
parent
92278796c3
commit
801672e3cb
|
|
@ -23,6 +23,12 @@ class AnnualReport
|
|||
@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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user