Add a count of blocked users on the dashboard
This commit is contained in:
parent
e3861893a2
commit
2259e97d42
|
@ -29,6 +29,7 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
|
||||||
});
|
});
|
||||||
c.set('admins', d.admins);
|
c.set('admins', d.admins);
|
||||||
c.set('moderators', d.moderators);
|
c.set('moderators', d.moderators);
|
||||||
|
c.set('blocked', d.blocked);
|
||||||
c.set('top_referrers', d.top_referrers);
|
c.set('top_referrers', d.top_referrers);
|
||||||
c.set('top_traffic_sources', d.top_traffic_sources);
|
c.set('top_traffic_sources', d.top_traffic_sources);
|
||||||
c.set('top_referred_topics', d.top_referred_topics);
|
c.set('top_referred_topics', d.top_referred_topics);
|
||||||
|
|
|
@ -35,6 +35,7 @@ Discourse.Route.buildRoutes(function() {
|
||||||
this.route('pending', { path: '/pending' });
|
this.route('pending', { path: '/pending' });
|
||||||
this.route('admins', { path: '/admins' });
|
this.route('admins', { path: '/admins' });
|
||||||
this.route('moderators', { path: '/moderators' });
|
this.route('moderators', { path: '/moderators' });
|
||||||
|
this.route('blocked', { path: '/blocked' });
|
||||||
// Trust Levels:
|
// Trust Levels:
|
||||||
this.route('newuser', { path: '/newuser' });
|
this.route('newuser', { path: '/newuser' });
|
||||||
this.route('basic', { path: '/basic' });
|
this.route('basic', { path: '/basic' });
|
||||||
|
|
|
@ -81,3 +81,17 @@ Discourse.AdminUsersListModeratorsRoute = Discourse.Route.extend({
|
||||||
return this.controllerFor('adminUsersList').show('moderators');
|
return this.controllerFor('adminUsersList').show('moderators');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
Handles the route that lists blocked users.
|
||||||
|
|
||||||
|
@class AdminUsersListBlockedRoute
|
||||||
|
@extends Discourse.Route
|
||||||
|
@namespace Discourse
|
||||||
|
@module Discourse
|
||||||
|
**/
|
||||||
|
Discourse.AdminUsersListBlockedRoute = Discourse.Route.extend({
|
||||||
|
setupController: function() {
|
||||||
|
return this.controllerFor('adminUsersList').show('blocked');
|
||||||
|
}
|
||||||
|
});
|
|
@ -101,6 +101,8 @@
|
||||||
<span class="value">{{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}}</span>
|
<span class="value">{{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}}</span>
|
||||||
<span class="title"><i class='icon icon-magic'></i> {{i18n admin.dashboard.moderators}}</span>
|
<span class="title"><i class='icon icon-magic'></i> {{i18n admin.dashboard.moderators}}</span>
|
||||||
<span class="value">{{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}}</span>
|
<span class="value">{{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}}</span>
|
||||||
|
<span class="title"><i class='icon icon-ban-circle'></i> {{i18n admin.dashboard.blocked}}</span>
|
||||||
|
<span class="value">{{#linkTo 'adminUsersList.blocked'}}{{blocked}}{{/linkTo}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dashboard-stats">
|
<div class="dashboard-stats">
|
||||||
|
|
|
@ -18,6 +18,7 @@ class Admin::UsersController < Admin::AdminController
|
||||||
|
|
||||||
@users = @users.where('admin = ?', true) if params[:query] == 'admins'
|
@users = @users.where('admin = ?', true) if params[:query] == 'admins'
|
||||||
@users = @users.where('moderator = ?', true) if params[:query] == 'moderators'
|
@users = @users.where('moderator = ?', true) if params[:query] == 'moderators'
|
||||||
|
@users = @users.blocked if params[:query] == 'blocked'
|
||||||
@users = @users.where('approved = false') if params[:query] == 'pending'
|
@users = @users.where('approved = false') if params[:query] == 'pending'
|
||||||
@users = @users.where('username_lower like :filter or email like :filter', filter: "%#{params[:filter]}%") if params[:filter].present?
|
@users = @users.where('username_lower like :filter or email like :filter', filter: "%#{params[:filter]}%") if params[:filter].present?
|
||||||
@users = @users.take(100)
|
@users = @users.take(100)
|
||||||
|
|
|
@ -49,6 +49,7 @@ class AdminDashboardData
|
||||||
reports: REPORTS.map { |type| Report.find(type).as_json },
|
reports: REPORTS.map { |type| Report.find(type).as_json },
|
||||||
admins: User.admins.count,
|
admins: User.admins.count,
|
||||||
moderators: User.moderators.count,
|
moderators: User.moderators.count,
|
||||||
|
blocked: User.blocked.count,
|
||||||
top_referrers: IncomingLinksReport.find('top_referrers').as_json,
|
top_referrers: IncomingLinksReport.find('top_referrers').as_json,
|
||||||
top_traffic_sources: IncomingLinksReport.find('top_traffic_sources').as_json,
|
top_traffic_sources: IncomingLinksReport.find('top_traffic_sources').as_json,
|
||||||
top_referred_topics: IncomingLinksReport.find('top_referred_topics').as_json
|
top_referred_topics: IncomingLinksReport.find('top_referred_topics').as_json
|
||||||
|
|
|
@ -61,6 +61,7 @@ class User < ActiveRecord::Base
|
||||||
scope :admins, ->{ where(admin: true) }
|
scope :admins, ->{ where(admin: true) }
|
||||||
scope :moderators, ->{ where(moderator: true) }
|
scope :moderators, ->{ where(moderator: true) }
|
||||||
scope :staff, ->{ where("moderator or admin ") }
|
scope :staff, ->{ where("moderator or admin ") }
|
||||||
|
scope :blocked, ->{ where(blocked: true) } # no index
|
||||||
|
|
||||||
module NewTopicDuration
|
module NewTopicDuration
|
||||||
ALWAYS = -1
|
ALWAYS = -1
|
||||||
|
|
|
@ -936,6 +936,7 @@ en:
|
||||||
no_problems: "No problems were found."
|
no_problems: "No problems were found."
|
||||||
moderators: 'Moderators:'
|
moderators: 'Moderators:'
|
||||||
admins: 'Admins:'
|
admins: 'Admins:'
|
||||||
|
blocked: 'Blocked:'
|
||||||
private_messages_short: "PMs"
|
private_messages_short: "PMs"
|
||||||
private_messages_title: "Private Messages"
|
private_messages_title: "Private Messages"
|
||||||
|
|
||||||
|
@ -1037,6 +1038,7 @@ en:
|
||||||
elder: 'Users at Trust Level 4 (Elder)'
|
elder: 'Users at Trust Level 4 (Elder)'
|
||||||
admins: 'Admin Users'
|
admins: 'Admin Users'
|
||||||
moderators: 'Moderators'
|
moderators: 'Moderators'
|
||||||
|
blocked: 'Blocked Users'
|
||||||
|
|
||||||
user:
|
user:
|
||||||
ban_failed: "Something went wrong banning this user {{error}}"
|
ban_failed: "Something went wrong banning this user {{error}}"
|
||||||
|
|
Loading…
Reference in New Issue