]>
cat aescling's git repositories - mastodon.git/blob - app/presenters/instance_presenter.rb
f3a73209afe56658c78372d3f2b272e5fbcdd10b
1 # frozen_string_literal: true
3 class InstancePresenter
7 :site_short_description,
9 :site_extended_description,
11 :closed_registrations_message,
16 Account
.find_local(Setting
.site_contact_username
.strip
.gsub(/\A@/, ''))
20 Rails
.cache
.fetch('user_count') { User
.confirmed
.joins(:account).merge(Account
.without_suspended
).count
}
24 Rails
.cache
.fetch('active_user_count') { Redis
.current
.pfcount(*(0..3).map
{ |i
| "activity:logins:#{i.weeks.ago.utc.to_date.cweek}" }) }
28 Rails
.cache
.fetch('local_status_count') { Account
.local
.joins(:account_stat).sum('account_stats.statuses_count') }.to_i
32 Rails
.cache
.fetch('distinct_domain_count') { Account
.distinct
.count(:domain) }
36 Rails
.cache
.fetch('sample_accounts', expires_in
: 12.hours
) { Account
.discoverable
.popular
.limit(3) }
44 Mastodon
::Version.source_url
48 @thumbnail ||= Rails
.cache
.fetch('site_uploads/thumbnail') { SiteUpload
.find_by(var
: 'thumbnail') }
52 @hero ||= Rails
.cache
.fetch('site_uploads/hero') { SiteUpload
.find_by(var
: 'hero') }
56 @mascot ||= Rails
.cache
.fetch('site_uploads/mascot') { SiteUpload
.find_by(var
: 'mascot') }
This page took 0.086802 seconds and 3 git commands to generate.