diff --git a/app/assets/javascripts/admin/routes/admin_dashboard_route.js b/app/assets/javascripts/admin/routes/admin_dashboard_route.js index 3698742ff95..721a1e66092 100644 --- a/app/assets/javascripts/admin/routes/admin_dashboard_route.js +++ b/app/assets/javascripts/admin/routes/admin_dashboard_route.js @@ -29,6 +29,7 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({ }); c.set('admins', d.admins); c.set('moderators', d.moderators); + c.set('blocked', d.blocked); c.set('top_referrers', d.top_referrers); c.set('top_traffic_sources', d.top_traffic_sources); c.set('top_referred_topics', d.top_referred_topics); diff --git a/app/assets/javascripts/admin/routes/admin_routes.js b/app/assets/javascripts/admin/routes/admin_routes.js index 0bff71adbc5..53a0af5eb3a 100644 --- a/app/assets/javascripts/admin/routes/admin_routes.js +++ b/app/assets/javascripts/admin/routes/admin_routes.js @@ -35,6 +35,7 @@ Discourse.Route.buildRoutes(function() { this.route('pending', { path: '/pending' }); this.route('admins', { path: '/admins' }); this.route('moderators', { path: '/moderators' }); + this.route('blocked', { path: '/blocked' }); // Trust Levels: this.route('newuser', { path: '/newuser' }); this.route('basic', { path: '/basic' }); diff --git a/app/assets/javascripts/admin/routes/admin_users_list_routes.js b/app/assets/javascripts/admin/routes/admin_users_list_routes.js index de5d8f8954f..e9e9341bbe5 100644 --- a/app/assets/javascripts/admin/routes/admin_users_list_routes.js +++ b/app/assets/javascripts/admin/routes/admin_users_list_routes.js @@ -80,4 +80,18 @@ Discourse.AdminUsersListModeratorsRoute = Discourse.Route.extend({ setupController: function() { 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'); + } }); \ No newline at end of file diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index 02b07be8dcc..955a80b7d4f 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -101,6 +101,8 @@ {{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}} {{i18n admin.dashboard.moderators}} {{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}} + {{i18n admin.dashboard.blocked}} + {{#linkTo 'adminUsersList.blocked'}}{{blocked}}{{/linkTo}}
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d35685cd045..01ceb39c51c 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -18,6 +18,7 @@ class Admin::UsersController < Admin::AdminController @users = @users.where('admin = ?', true) if params[:query] == 'admins' @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('username_lower like :filter or email like :filter', filter: "%#{params[:filter]}%") if params[:filter].present? @users = @users.take(100) diff --git a/app/models/admin_dashboard_data.rb b/app/models/admin_dashboard_data.rb index c5375311245..fb614bffd1e 100644 --- a/app/models/admin_dashboard_data.rb +++ b/app/models/admin_dashboard_data.rb @@ -49,6 +49,7 @@ class AdminDashboardData reports: REPORTS.map { |type| Report.find(type).as_json }, admins: User.admins.count, moderators: User.moderators.count, + blocked: User.blocked.count, top_referrers: IncomingLinksReport.find('top_referrers').as_json, top_traffic_sources: IncomingLinksReport.find('top_traffic_sources').as_json, top_referred_topics: IncomingLinksReport.find('top_referred_topics').as_json diff --git a/app/models/user.rb b/app/models/user.rb index d8eacf5d418..0487c51685f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -61,6 +61,7 @@ class User < ActiveRecord::Base scope :admins, ->{ where(admin: true) } scope :moderators, ->{ where(moderator: true) } scope :staff, ->{ where("moderator or admin ") } + scope :blocked, ->{ where(blocked: true) } # no index module NewTopicDuration ALWAYS = -1 diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index fee4f6b931c..6011936edf4 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -936,6 +936,7 @@ en: no_problems: "No problems were found." moderators: 'Moderators:' admins: 'Admins:' + blocked: 'Blocked:' private_messages_short: "PMs" private_messages_title: "Private Messages" @@ -1037,6 +1038,7 @@ en: elder: 'Users at Trust Level 4 (Elder)' admins: 'Admin Users' moderators: 'Moderators' + blocked: 'Blocked Users' user: ban_failed: "Something went wrong banning this user {{error}}"