[Mod] Allow exporting address lists for PII requests.

This commit is contained in:
Kira 2022-05-05 12:17:50 -07:00
parent 0842a50ad5
commit 500df9d3ee
3 changed files with 16 additions and 1 deletions

View File

@ -8,5 +8,15 @@ module Moderator
@results = search.execute
respond_with(@results)
end
def export
search = IpAddrSearch.new(params[:search].merge({with_history: true}))
@results = search.execute
respond_with(@results) do |format|
format.json do
render json: @results[:ip_addrs].uniq
end
end
end
end
end

View File

@ -1,4 +1,5 @@
<p><%= link_to "Search for users with these IP addresses", moderator_ip_addrs_path(search: {ip_addr: @results[:ip_addrs].reject{|ip| ip == "127.0.0.1"}.join(","), with_history: params[:search][:with_history]}) %></p>
<p><%= link_to "Export address list", export_moderator_ip_addrs_path(format: :json, search: {user_id: params[:search][:user_id]}) %></p>
<table class="striped">
<thead>

View File

@ -32,7 +32,11 @@ Rails.application.routes.draw do
resources :edit_histories
namespace :moderator do
resource :dashboard, :only => [:show]
resources :ip_addrs, :only => [:index]
resources :ip_addrs, :only => [:index] do
collection do
get :export
end
end
resource :tag, :only => [:edit, :update]
namespace :post do
resource :queue, :only => [:show]