about summary refs log tree commit diff
path: root/app/presenters
diff options
context:
space:
mode:
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/instance_presenter.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb
new file mode 100644
index 000000000..cd809566f
--- /dev/null
+++ b/app/presenters/instance_presenter.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class InstancePresenter
+  delegate(
+    :closed_registrations_message,
+    :contact_email,
+    :open_registrations,
+    :site_description,
+    :site_extended_description,
+    to: Setting
+  )
+
+  def contact_account
+    Account.find_local(Setting.site_contact_username)
+  end
+
+  def user_count
+    Rails.cache.fetch('user_count') { User.count }
+  end
+
+  def status_count
+    Rails.cache.fetch('local_status_count') { Status.local.count }
+  end
+
+  def domain_count
+    Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
+  end
+end