mirror of
https://github.com/mastodon/mastodon.git
synced 2025-12-13 18:52: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
|
@year = year
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def eligible?
|
||||||
|
with_read_replica do
|
||||||
|
SOURCES.all? { |klass| klass.new(@account, @year).eligible? }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
return if GeneratedAnnualReport.exists?(account: @account, year: @year)
|
return if GeneratedAnnualReport.exists?(account: @account, year: @year)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ class AnnualReport::Source
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def eligible?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def report_statuses
|
def report_statuses
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ class AnnualReport::TopHashtags < AnnualReport::Source
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def eligible?
|
||||||
|
report_statuses.joins(:tags).exists?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def top_hashtags
|
def top_hashtags
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ class AnnualReport::TopStatuses < AnnualReport::Source
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def eligible?
|
||||||
|
report_statuses.public_visibility.exists?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def status_identifier(status)
|
def status_identifier(status)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user