logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

instance_presenter.rb (992B)


  1. # frozen_string_literal: true
  2. class InstancePresenter
  3. delegate(
  4. :closed_registrations_message,
  5. :site_contact_email,
  6. :open_registrations,
  7. :site_title,
  8. :site_description,
  9. :site_extended_description,
  10. :site_terms,
  11. to: Setting
  12. )
  13. def contact_account
  14. Account.find_local(Setting.site_contact_username)
  15. end
  16. def user_count
  17. Rails.cache.fetch('user_count') { User.confirmed.count }
  18. end
  19. def status_count
  20. Rails.cache.fetch('local_status_count') { Account.local.sum(:statuses_count) }
  21. end
  22. def domain_count
  23. Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
  24. end
  25. def version_number
  26. Mastodon::Version
  27. end
  28. def source_url
  29. Mastodon::Version.source_url
  30. end
  31. def thumbnail
  32. @thumbnail ||= Rails.cache.fetch('site_uploads/thumbnail') { SiteUpload.find_by(var: 'thumbnail') }
  33. end
  34. def hero
  35. @hero ||= Rails.cache.fetch('site_uploads/hero') { SiteUpload.find_by(var: 'hero') }
  36. end
  37. end