about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-04-03 13:06:34 +0200
committerGitHub <noreply@github.com>2020-04-03 13:06:34 +0200
commitf65568f1d400be2e101bd8b533a1b53807f5c757 (patch)
treeaaf08fac72a54d240555cfc0fc900f4e491111d2 /app/views
parent69558d2fe5284d2b6168706bd7cbd8b7fb2b0847 (diff)
Add ability to filter audit log in admin UI (#13381)
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin/accounts/show.html.haml2
-rw-r--r--app/views/admin/action_logs/_action_log.html.haml6
-rw-r--r--app/views/admin/action_logs/index.html.haml24
3 files changed, 24 insertions, 8 deletions
diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml
index 744d17d1f..965fd6fb6 100644
--- a/app/views/admin/accounts/show.html.haml
+++ b/app/views/admin/accounts/show.html.haml
@@ -53,7 +53,7 @@
       .dashboard__counters__num= number_with_delimiter @account.targeted_reports.count
       .dashboard__counters__label= t '.targeted_reports'
   %div
-    %div
+    = link_to admin_action_logs_path(target_account_id: @account.id) do
       .dashboard__counters__text
         - if @account.local? && @account.user.nil?
           %span.neutral= t('admin.accounts.deleted')
diff --git a/app/views/admin/action_logs/_action_log.html.haml b/app/views/admin/action_logs/_action_log.html.haml
index a545e189e..59905f341 100644
--- a/app/views/admin/action_logs/_action_log.html.haml
+++ b/app/views/admin/action_logs/_action_log.html.haml
@@ -7,9 +7,3 @@
         = t("admin.action_logs.actions.#{action_log.action}_#{action_log.target_type.underscore}", name: content_tag(:span, action_log.account.username, class: 'username'), target: content_tag(:span, log_target(action_log), class: 'target')).html_safe
       .log-entry__timestamp
         %time.formatted{ datetime: action_log.created_at.iso8601 }
-    .spacer
-    .log-entry__icon
-      = fa_icon icon_for_log(action_log)
-      .log-entry__icon__overlay{ class: class_for_log_icon(action_log) }
-  .log-entry__extras
-    = log_extra_attributes relevant_log_changes(action_log)
diff --git a/app/views/admin/action_logs/index.html.haml b/app/views/admin/action_logs/index.html.haml
index a4d3871a9..99f756762 100644
--- a/app/views/admin/action_logs/index.html.haml
+++ b/app/views/admin/action_logs/index.html.haml
@@ -1,6 +1,28 @@
 - content_for :page_title do
   = t('admin.action_logs.title')
 
-= render @action_logs
+- content_for :header_tags do
+  = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
+
+= form_tag admin_action_logs_url, method: 'GET', class: 'simple_form' do
+  = hidden_field_tag :target_account_id, params[:target_account_id] if params[:target_account_id].present?
+
+  .filters
+    .filter-subset.filter-subset--with-select
+      %strong= t('admin.action_logs.filter_by_user')
+      .input.select.optional
+        = select_tag :account_id, options_from_collection_for_select(Account.joins(:user).merge(User.staff), :id, :username, params[:account_id]), prompt: I18n.t('admin.accounts.moderation.all')
+
+    .filter-subset.filter-subset--with-select
+      %strong= t('admin.action_logs.filter_by_action')
+      .input.select.optional
+        = select_tag :action_type, options_for_select(Admin::ActionLogFilter::ACTION_TYPE_MAP.keys.map { |key| [I18n.t("admin.action_logs.action_types.#{key}"), key]}, params[:action_type]), prompt: I18n.t('admin.accounts.moderation.all')
+
+- if @action_logs.empty?
+  %div.muted-hint.center-text
+    = t 'admin.action_logs.empty'
+- else
+  .announcements-list
+    = render @action_logs
 
 = paginate @action_logs