diff --git a/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js b/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js
index 6692643ab06..fc87116c2c9 100644
--- a/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js
+++ b/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js
@@ -8,11 +8,12 @@
**/
Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Discourse.Presence, {
loading: false,
+ filters: null,
- show: function() {
+ show: function(filters) {
var self = this;
this.set('loading', true);
- Discourse.StaffActionLog.findAll().then(function(result) {
+ Discourse.StaffActionLog.findAll(this.get('filters')).then(function(result) {
self.set('content', result);
self.set('loading', false);
});
@@ -20,5 +21,23 @@ Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Disc
toggleFullDetails: function(target) {
target.set('showFullDetails', !target.get('showFullDetails'));
+ },
+
+ clearFiltersClass: function() {
+ if (this.get('filters') === null) {
+ return 'invisible';
+ } else {
+ return '';
+ }
+ }.property('filters'),
+
+ clearFilters: function() {
+ this.set('filters', null);
+ this.show();
+ },
+
+ filterByAction: function(action) {
+ this.set('filters', {action_name: action});
+ this.show();
}
});
diff --git a/app/assets/javascripts/admin/models/staff_action_log.js b/app/assets/javascripts/admin/models/staff_action_log.js
index d609f6ddfbe..294a5abd4b4 100644
--- a/app/assets/javascripts/admin/models/staff_action_log.js
+++ b/app/assets/javascripts/admin/models/staff_action_log.js
@@ -36,8 +36,8 @@ Discourse.StaffActionLog.reopenClass({
return this._super(attrs);
},
- findAll: function(filter) {
- return Discourse.ajax("/admin/logs/staff_action_logs.json").then(function(staff_actions) {
+ findAll: function(filters) {
+ return Discourse.ajax("/admin/logs/staff_action_logs.json", { data: filters }).then(function(staff_actions) {
return staff_actions.map(function(s) {
return Discourse.StaffActionLog.create(s);
});
diff --git a/app/assets/javascripts/admin/templates/logs/blocked_emails.js.handlebars b/app/assets/javascripts/admin/templates/logs/blocked_emails.js.handlebars
index f5e48aaf7c8..9da0ba1f8c6 100644
--- a/app/assets/javascripts/admin/templates/logs/blocked_emails.js.handlebars
+++ b/app/assets/javascripts/admin/templates/logs/blocked_emails.js.handlebars
@@ -1,3 +1,5 @@
+
{{i18n admin.logs.blocked_emails.description}}
+
{{#if loading}}
{{i18n loading}}
{{else}}
diff --git a/app/assets/javascripts/admin/templates/logs/staff_action_logs.js.handlebars b/app/assets/javascripts/admin/templates/logs/staff_action_logs.js.handlebars
index 4f2e03289f2..8cb22203f1a 100644
--- a/app/assets/javascripts/admin/templates/logs/staff_action_logs.js.handlebars
+++ b/app/assets/javascripts/admin/templates/logs/staff_action_logs.js.handlebars
@@ -1,21 +1,28 @@
-{{#if loading}}
- {{i18n loading}}
-{{else}}
- {{#if model.length}}
-
-
-
{{i18n admin.logs.action}}
-
{{i18n admin.logs.staff_actions.staff_user}}
-
{{i18n admin.logs.staff_actions.target_user}}
-
{{i18n admin.logs.staff_actions.when}}
-
{{i18n admin.logs.staff_actions.context}}
-
{{i18n admin.logs.staff_actions.details}}
-
-
- {{view Discourse.StaffActionLogsListView contentBinding="controller"}}
-
+
+ {{i18n admin.logs.staff_actions.clear_filters}}
+
+
+
+
+
+
{{i18n admin.logs.action}}
+
{{i18n admin.logs.staff_actions.staff_user}}
+
{{i18n admin.logs.staff_actions.target_user}}
+
{{i18n admin.logs.staff_actions.when}}
+
{{i18n admin.logs.staff_actions.context}}
+
{{i18n admin.logs.staff_actions.details}}
+
+
+
+ {{#if loading}}
+
+
{{i18n loading}}
{{else}}
- {{i18n search.no_results}}
+ {{#if model.length}}
+ {{view Discourse.StaffActionLogsListView contentBinding="controller"}}
+ {{else}}
+ {{i18n search.no_results}}
+ {{/if}}
{{/if}}
-{{/if}}
\ No newline at end of file
+
diff --git a/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars b/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars
index 1ffea587d7d..2604b7fc384 100644
--- a/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars
+++ b/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars
@@ -1,4 +1,6 @@
-{{actionName}}
+
{{#linkTo 'adminUser' staff_user}}{{avatar staff_user imageSize="tiny"}}{{/linkTo}}
{{#linkTo 'adminUser' staff_user}}{{staff_user.username}}{{/linkTo}}
diff --git a/app/assets/stylesheets/admin/admin_base.scss b/app/assets/stylesheets/admin/admin_base.scss
index 8d6b39bff53..46e7ad7810e 100644
--- a/app/assets/stylesheets/admin/admin_base.scss
+++ b/app/assets/stylesheets/admin/admin_base.scss
@@ -18,6 +18,10 @@
margin-bottom: 50px;
.admin-contents {
padding: 8px;
+
+ p {
+ margin-left: 6px;
+ }
}
table.report {
diff --git a/app/controllers/admin/staff_action_logs_controller.rb b/app/controllers/admin/staff_action_logs_controller.rb
index fc3ed049c20..e9b341a6325 100644
--- a/app/controllers/admin/staff_action_logs_controller.rb
+++ b/app/controllers/admin/staff_action_logs_controller.rb
@@ -1,7 +1,7 @@
class Admin::StaffActionLogsController < Admin::AdminController
def index
- staff_action_logs = StaffActionLog.limit(200).order('id DESC').includes(:staff_user, :target_user).to_a
+ staff_action_logs = StaffActionLog.with_filters(params.slice(:action_name)).limit(200).order('id DESC').includes(:staff_user, :target_user).to_a
render_serialized(staff_action_logs, StaffActionLogSerializer)
end
diff --git a/app/models/staff_action_log.rb b/app/models/staff_action_log.rb
index b43c1a04e2d..e829a792700 100644
--- a/app/models/staff_action_log.rb
+++ b/app/models/staff_action_log.rb
@@ -11,6 +11,14 @@ class StaffActionLog < ActiveRecord::Base
def self.actions
@actions ||= Enum.new(:delete_user, :change_trust_level)
end
+
+ def self.with_filters(filters)
+ query = self
+ if filters[:action_name] and action_id = StaffActionLog.actions[filters[:action_name].to_sym]
+ query = query.where('action = ?', action_id)
+ end
+ query
+ end
end
# == Schema Information
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 2d24c5f315f..5443aec44fc 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1168,6 +1168,7 @@ en:
created_at: "Created"
blocked_emails:
title: "Blocked Emails"
+ description: "When someone tries to create a new account, the following email addresses will be checked and the registration will be blocked, or some other action performed."
email: "Email Address"
last_match_at: "Last Matched"
match_count: "Matches"
@@ -1176,6 +1177,7 @@ en:
do_nothing: "do nothing"
staff_actions:
title: "Staff Actions"
+ clear_filters: "Show All"
staff_user: "Staff User"
target_user: "Target User"
when: "When"