Skip to content

Commit

Permalink
When taking action on a report (silence/suspend), it dismisses all other
Browse files Browse the repository at this point in the history
reports for that user automatically
  • Loading branch information
Gargron committed Apr 3, 2017
1 parent b7c1b12 commit 71458dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def resolve

def suspend
Admin::SuspensionWorker.perform_async(@report.target_account.id)
@report.update(action_taken: true)
Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true)
redirect_to admin_report_path(@report)
end

def silence
@report.target_account.update(silenced: true)
@report.update(action_taken: true)
Report.unresolved.where(target_account: @report.target_account).update_all(action_taken: true)
redirect_to admin_report_path(@report)
end

Expand Down
35 changes: 20 additions & 15 deletions app/views/admin/reports/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
%li= filter_link_to 'Unresolved', action_taken: nil
%li= filter_link_to 'Resolved', action_taken: '1'

%table.table
%thead
%tr
%th ID
%th Target
%th Reported by
%th Comment
%th
%tbody
- @reports.each do |report|
= form_tag do

%table.table
%thead
%tr
%td= "##{report.id}"
%td= link_to report.target_account.acct, admin_account_path(report.target_account.id)
%td= link_to report.account.acct, admin_account_path(report.account.id)
%td= truncate(report.comment, length: 30, separator: ' ')
%td= table_link_to 'circle', 'View', admin_report_path(report)
%th
%th ID
%th Target
%th Reported by
%th Comment
%th
%tbody
- @reports.each do |report|
%tr
%td= check_box_tag 'select', report.id
%td= "##{report.id}"
%td= link_to report.target_account.acct, admin_account_path(report.target_account.id)
%td= link_to report.account.acct, admin_account_path(report.account.id)
%td= truncate(report.comment, length: 30, separator: ' ')
%td= table_link_to 'circle', 'View', admin_report_path(report)

= will_paginate @reports, pagination_options

0 comments on commit 71458dc

Please sign in to comment.