]> cat aescling's git repositories - mastodon.git/blob - app/presenters/instance_presenter.rb
Replace SVG asset with Custom mascot (#8766)
[mastodon.git] / app / presenters / instance_presenter.rb
1 # frozen_string_literal: true
2
3 class InstancePresenter
4 delegate(
5 :closed_registrations_message,
6 :site_contact_email,
7 :open_registrations,
8 :site_title,
9 :site_short_description,
10 :site_description,
11 :site_extended_description,
12 :site_terms,
13 to: Setting
14 )
15
16 def contact_account
17 Account.find_local(Setting.site_contact_username.gsub(/\A@/, ''))
18 end
19
20 def user_count
21 Rails.cache.fetch('user_count') { User.confirmed.count }
22 end
23
24 def status_count
25 Rails.cache.fetch('local_status_count') { Account.local.sum(:statuses_count) }
26 end
27
28 def domain_count
29 Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
30 end
31
32 def version_number
33 Mastodon::Version
34 end
35
36 def source_url
37 Mastodon::Version.source_url
38 end
39
40 def thumbnail
41 @thumbnail ||= Rails.cache.fetch('site_uploads/thumbnail') { SiteUpload.find_by(var: 'thumbnail') }
42 end
43
44 def hero
45 @hero ||= Rails.cache.fetch('site_uploads/hero') { SiteUpload.find_by(var: 'hero') }
46 end
47
48 def mascot
49 @mascot ||= Rails.cache.fetch('site_uploads/mascot') { SiteUpload.find_by(var: 'mascot') }
50 end
51 end
This page took 0.129185 seconds and 5 git commands to generate.