Add wrapstodon to initial state and show wrapstodon sidebar item on load (#37261)

This commit is contained in:
Claire
2025-12-16 10:47:18 +01:00
committed by GitHub
parent 4c679c698f
commit 550a6d4765
5 changed files with 50 additions and 17 deletions

View File

@@ -57,27 +57,18 @@ class Api::V1::AnnualReportsController < Api::BaseController
render_empty
end
def refresh_key
"wrapstodon:#{current_account.id}:#{year}"
end
private
def report_state
return 'available' if GeneratedAnnualReport.exists?(account_id: current_account.id, year: year)
async_refresh = AsyncRefresh.new(refresh_key)
if async_refresh.running?
AnnualReport.new(current_account, year).state do |async_refresh|
add_async_refresh_header(async_refresh, retry_seconds: 2)
'generating'
elsif AnnualReport.current_campaign == year && AnnualReport.new(current_account, year).eligible?
'eligible'
else
'ineligible'
end
end
def refresh_key
"wrapstodon:#{current_account.id}:#{year}"
end
def year
params[:id]&.to_i
end