add targeted post down voting report, add delayed job plugin to disable statement timeout

This commit is contained in:
r888888888
2017-10-10 12:56:57 -07:00
parent 51867a8c64
commit 13f7d7e66d
6 changed files with 48 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
class ReportsController < ApplicationController
before_filter :member_only, :except => [:upload_tags]
before_filter :gold_only, :only => [:similar_users]
before_filter :moderator_only, :only => [:post_versions, :post_versions_create]
before_filter :moderator_only, :only => [:post_versions, :post_versions_create, :down_voting_post_report, :down_voting_post_report_create]
def uploads
@report = Reports::Uploads.new(params[:min_date], params[:max_date], params[:queries])
@@ -23,4 +23,16 @@ class ReportsController < ApplicationController
@user = User.find(params[:user_id])
@upload_reports = Reports::UploadTags.includes(versions: { post: :versions }).for_user(params[:user_id]).order("id desc").paginate(params[:page], :limit => params[:limit])
end
def down_voting_post
end
def down_voting_post_create
user_id = CurrentUser.id
post_id = params[:post_id].to_i
sqs = SqsService.new(Danbooru.config.aws_sqs_async_reports)
sqs.send_message("targetedpostdownvoting-#{user_id}-#{post_id}")
flash[:notice] = "You will be messaged when the report has finished generating"
redirect_to reports_down_voting_post_path
end
end

View File

@@ -56,6 +56,10 @@
<% end %>
<li><%= link_to "Replace Image", new_post_replacement_path(:post_id => post.id), :id => "replace-image" %></li>
<% if CurrentUser.is_moderator? %>
<li><%= link_to "Down vote report", reports_down_voting_post_path(post_id: post.id) %></li>
<% end %>
<% end %>
<% end %>
<% end %>

View File

@@ -0,0 +1,17 @@
<div id="c-reports">
<div id="a-down-voting-post-report">
<h1>Down Voting Post Report</h1>
<p>This report uses stastistical analysis to determine if a user's uploads are being targeted by an attacker. It will take some time to generate so you will receive a DMail with the results when it finishes.</p>
<%= form_tag(reports_down_voting_post_create_path) do %>
<%= hidden_field_tag "post_id", params[:post_id] %>
<%= submit_tag "Build" %>
<% end %>
</div>
</div>
<% content_for(:page_title) do %>
Down Voting Post Report - <%= Danbooru.config.app_name %>
<% end %>