]> cat aescling's git repositories - mastodon.git/blob - app/controllers/admin/dashboard_controller.rb
Change icons of features on admin dashboard to remove bias (#10366)
[mastodon.git] / app / controllers / admin / dashboard_controller.rb
1 # frozen_string_literal: true
2 require 'sidekiq/api'
3
4 module Admin
5 class DashboardController < BaseController
6 def index
7 @users_count = User.count
8 @registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
9 @logins_week = Redis.current.pfcount("activity:logins:#{current_week}")
10 @interactions_week = Redis.current.get("activity:interactions:#{current_week}") || 0
11 @relay_enabled = Relay.enabled.exists?
12 @single_user_mode = Rails.configuration.x.single_user_mode
13 @registrations_enabled = Setting.registrations_mode != 'none'
14 @deletions_enabled = Setting.open_deletion
15 @invites_enabled = Setting.min_invite_role == 'user'
16 @search_enabled = Chewy.enabled?
17 @version = Mastodon::Version.to_s
18 @database_version = ActiveRecord::Base.connection.execute('SELECT VERSION()').first['version'].match(/\A(?:PostgreSQL |)([^\s]+).*\z/)[1]
19 @redis_version = redis_info['redis_version']
20 @reports_count = Report.unresolved.count
21 @queue_backlog = Sidekiq::Stats.new.enqueued
22 @recent_users = User.confirmed.recent.includes(:account).limit(4)
23 @database_size = ActiveRecord::Base.connection.execute('SELECT pg_database_size(current_database())').first['pg_database_size']
24 @redis_size = redis_info['used_memory']
25 @ldap_enabled = ENV['LDAP_ENABLED'] == 'true'
26 @cas_enabled = ENV['CAS_ENABLED'] == 'true'
27 @saml_enabled = ENV['SAML_ENABLED'] == 'true'
28 @pam_enabled = ENV['PAM_ENABLED'] == 'true'
29 @hidden_service = ENV['ALLOW_ACCESS_TO_HIDDEN_SERVICE'] == 'true'
30 @trending_hashtags = TrendingTags.get(7)
31 @profile_directory = Setting.profile_directory
32 @timeline_preview = Setting.timeline_preview
33 end
34
35 private
36
37 def current_week
38 @current_week ||= Time.now.utc.to_date.cweek
39 end
40
41 def redis_info
42 @redis_info ||= Redis.current.info
43 end
44 end
45 end
This page took 0.109843 seconds and 6 git commands to generate.