Skip to content

Commit f5bf764

Browse files
Gargronhiyuki2578
authored andcommitted
Add number of pending accounts and pending hashtags to admin dashboard (mastodon#11514)
1 parent b844770 commit f5bf764

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

app/controllers/admin/dashboard_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Admin
55
class DashboardController < BaseController
66
def index
77
@users_count = User.count
8+
@pending_users_count = User.pending.count
89
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
910
@logins_week = Redis.current.pfcount("activity:logins:#{current_week}")
1011
@interactions_week = Redis.current.get("activity:interactions:#{current_week}") || 0
@@ -19,7 +20,7 @@ def index
1920
@redis_version = redis_info['redis_version']
2021
@reports_count = Report.unresolved.count
2122
@queue_backlog = Sidekiq::Stats.new.enqueued
22-
@recent_users = User.confirmed.recent.includes(:account).limit(4)
23+
@recent_users = User.confirmed.recent.includes(:account).limit(8)
2324
@database_size = ActiveRecord::Base.connection.execute('SELECT pg_database_size(current_database())').first['pg_database_size']
2425
@redis_size = redis_info['used_memory']
2526
@ldap_enabled = ENV['LDAP_ENABLED'] == 'true'
@@ -28,6 +29,7 @@ def index
2829
@pam_enabled = ENV['PAM_ENABLED'] == 'true'
2930
@hidden_service = ENV['ALLOW_ACCESS_TO_HIDDEN_SERVICE'] == 'true'
3031
@trending_hashtags = TrendingTags.get(10, filtered: false)
32+
@pending_tags_count = Tag.pending_review.count
3133
@authorized_fetch = authorized_fetch_mode?
3234
@whitelist_enabled = whitelist_mode?
3335
@profile_directory = Setting.profile_directory

app/views/admin/dashboard/index.html.haml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@
1515
.dashboard__counters__num= number_with_delimiter @logins_week
1616
.dashboard__counters__label= t 'admin.dashboard.week_users_active'
1717
%div
18-
%div
19-
.dashboard__counters__num= number_with_delimiter @interactions_week
20-
.dashboard__counters__label= t 'admin.dashboard.week_interactions'
18+
= link_to admin_pending_accounts_path do
19+
.dashboard__counters__num= number_with_delimiter @pending_users_count
20+
.dashboard__counters__label= t 'admin.dashboard.pending_users'
2121
%div
2222
= link_to admin_reports_url do
2323
.dashboard__counters__num= number_with_delimiter @reports_count
2424
.dashboard__counters__label= t 'admin.dashboard.open_reports'
25+
%div
26+
= link_to admin_tags_path(review: 'pending_review') do
27+
.dashboard__counters__num= number_with_delimiter @pending_tags_count
28+
.dashboard__counters__label= t 'admin.dashboard.pending_tags'
29+
%div
30+
%div
31+
.dashboard__counters__num= number_with_delimiter @interactions_week
32+
.dashboard__counters__label= t 'admin.dashboard.week_interactions'
2533
%div
2634
= link_to sidekiq_url do
2735
.dashboard__counters__num= number_with_delimiter @queue_backlog

app/views/admin/tags/show.html.haml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
.fields-group
1111
= f.input :usable, as: :boolean, wrapper: :with_label
12-
= f.input :trendable, as: :boolean, wrapper: :with_label
13-
= f.input :listable, as: :boolean, wrapper: :with_label
12+
= f.input :trendable, as: :boolean, wrapper: :with_label, disabled: !Setting.trends
13+
= f.input :listable, as: :boolean, wrapper: :with_label, disabled: !Setting.profile_directory
1414

1515
.actions
1616
= f.button :button, t('generic.save_changes'), type: :submit

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ en:
261261
features: Features
262262
hidden_service: Federation with hidden services
263263
open_reports: open reports
264+
pending_tags: hashtags waiting for review
265+
pending_users: users waiting for review
264266
recent_users: Recent users
265267
search: Full-text search
266268
single_user_mode: Single user mode

0 commit comments

Comments
 (0)