diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-03-13 15:16:02 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-13 15:16:02 +0100 |
commit | 02062aab55cb6f8da527998a210775c2ad695eed (patch) | |
tree | ab606ee84d964f28dad5bc77cfbd49b5c12849fa /app/presenters | |
parent | c2857c976c7d4a8bbd02c3c18569913f2bf8a034 (diff) | |
parent | 06663fcf87fe0d6bc71336e6f212b82f098066d7 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/about_controller.rb - app/controllers/tags_controller.rb - app/views/about/show.html.haml - spec/views/about/show.html.haml_spec.rb
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/instance_presenter.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index d8670f124..58e3541c1 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -21,6 +21,10 @@ class InstancePresenter Rails.cache.fetch('user_count') { User.confirmed.joins(:account).merge(Account.without_suspended).count } end + def active_user_count + Rails.cache.fetch('active_user_count') { Redis.current.pfcount(*(0..3).map { |i| "activity:logins:#{i.weeks.ago.utc.to_date.cweek}" }) } + end + def status_count Rails.cache.fetch('local_status_count') { Account.local.joins(:account_stat).sum('account_stats.statuses_count') }.to_i end @@ -29,6 +33,10 @@ class InstancePresenter Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) } end + def sample_accounts + Rails.cache.fetch('sample_accounts', expires_in: 12.hours) { Account.discoverable.popular.limit(3) } + end + def version_number Mastodon::Version end |