add support for post version queries
This commit is contained in:
@@ -478,6 +478,10 @@ div#c-post-versions, div#c-artist-versions {
|
|||||||
word-wrap: break-word
|
word-wrap: break-word
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr.hilite {
|
||||||
|
background: $highlight_color;
|
||||||
|
}
|
||||||
|
|
||||||
ins, ins a {
|
ins, ins a {
|
||||||
color: green;
|
color: green;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class ReportsController < ApplicationController
|
class ReportsController < ApplicationController
|
||||||
before_filter :member_only
|
before_filter :member_only
|
||||||
before_filter :gold_only, :only => [:similar_users]
|
before_filter :gold_only, :only => [:similar_users]
|
||||||
|
before_filter :janitor_only, :only => [:post_versions, :post_versions_create]
|
||||||
|
|
||||||
def user_promotions
|
def user_promotions
|
||||||
@report = Reports::UserPromotions.new
|
@report = Reports::UserPromotions.new
|
||||||
@@ -22,4 +23,18 @@ class ReportsController < ApplicationController
|
|||||||
@report = Reports::UserSimilarity.new(CurrentUser.id)
|
@report = Reports::UserSimilarity.new(CurrentUser.id)
|
||||||
@presenter = UserSimilarityPresenter.new(@report)
|
@presenter = UserSimilarityPresenter.new(@report)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def post_versions
|
||||||
|
end
|
||||||
|
|
||||||
|
def post_versions_create
|
||||||
|
if params[:type] == "added"
|
||||||
|
@report = Reports::PostVersionsAdded.new(params[:tag])
|
||||||
|
else
|
||||||
|
@report = Reports::PostVersionRemoved.new(params[:tag])
|
||||||
|
end
|
||||||
|
@report.process!
|
||||||
|
flash[:notice] = "Report is being generated and will be emailed to you shortly"
|
||||||
|
redirect_to reports_post_versions_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
17
app/logical/reports/post_versions_added.rb
Normal file
17
app/logical/reports/post_versions_added.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module Reports
|
||||||
|
class PostVersionsAdded
|
||||||
|
attr_reader :tag, :email
|
||||||
|
|
||||||
|
def initialize(tag, email)
|
||||||
|
@tag = tag
|
||||||
|
@email = email
|
||||||
|
end
|
||||||
|
|
||||||
|
def process!
|
||||||
|
if tag
|
||||||
|
json = {"type" => "post_versions_added", "tag" => tag, "email" => email}.to_json
|
||||||
|
SqsService.new(Danbooru.config.aws_sqs_post_versions_url).send_message(json)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
17
app/logical/reports/post_versions_removed.rb
Normal file
17
app/logical/reports/post_versions_removed.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module Reports
|
||||||
|
class PostVersionsRemoved
|
||||||
|
attr_reader :tag, :email
|
||||||
|
|
||||||
|
def initialize(tag, email)
|
||||||
|
@tag = tag
|
||||||
|
@email = email
|
||||||
|
end
|
||||||
|
|
||||||
|
def process!
|
||||||
|
if tag
|
||||||
|
json = {"type" => "post_versions_removed", "tag" => tag, "email" => email}.to_json
|
||||||
|
SqsService.new(Danbooru.config.aws_sqs_post_versions_url).send_message(json)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% post_versions.each do |post_version| %>
|
<% post_versions.each do |post_version| %>
|
||||||
<tr id="post-version-<%= post_version.id %>">
|
<tr id="post-version-<%= post_version.id %>" <% if params[:hilite].to_i == post_version.id %>class="hilite"<% end %>>
|
||||||
<td><%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %></td>
|
<td><%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %></td>
|
||||||
<td><%= compact_time(post_version.updated_at) %></td>
|
<td><%= compact_time(post_version.updated_at) %></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
27
app/views/reports/post_versions.html.erb
Normal file
27
app/views/reports/post_versions.html.erb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<div id="c-reports">
|
||||||
|
<div id="a-post-versions">
|
||||||
|
<h1>Post Changes Report</h1>
|
||||||
|
|
||||||
|
<p>You can search all post changes to find when and where a tag was added or removed. Because these queries can take a long time to generate the results will be emailed to you. Only the 1,000 most recent changes will be returned.</p>
|
||||||
|
|
||||||
|
<%= form_tag(reports_post_versions_create_path, :method => :post, :class => "simple_form") do %>
|
||||||
|
<div class="input">
|
||||||
|
<label for="tag">Tag</label>
|
||||||
|
<%= text_field_tag "tag" %>
|
||||||
|
<%= select_tag "type", options_for_select(%w(added removed)) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input">
|
||||||
|
<label for="Email">Email</label>
|
||||||
|
<%= text_field_tag "email", CurrentUser.user.email %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= submit_tag "Submit" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Post Changes Report - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
<% if Danbooru.config.report_server %>
|
<% if Danbooru.config.report_server %>
|
||||||
<li><%= link_to("Top Searches", searches_explore_posts_path) %></li>
|
<li><%= link_to("Top Searches", searches_explore_posts_path) %></li>
|
||||||
<li><%= link_to("Missed Searches", missed_searches_explore_posts_path) %></li>
|
<li><%= link_to("Missed Searches", missed_searches_explore_posts_path) %></li>
|
||||||
|
<li><%= link_to("Post Changes", reports_post_versions_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -453,6 +453,9 @@ module Danbooru
|
|||||||
def aws_sqs_reltagcalc_url
|
def aws_sqs_reltagcalc_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def aws_sqs_post_versions_url
|
||||||
|
end
|
||||||
|
|
||||||
def aws_sqs_region
|
def aws_sqs_region
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ Rails.application.routes.draw do
|
|||||||
get "reports/contributors" => "reports#contributors"
|
get "reports/contributors" => "reports#contributors"
|
||||||
get "reports/uploads" => "reports#uploads"
|
get "reports/uploads" => "reports#uploads"
|
||||||
get "reports/similar_users" => "reports#similar_users"
|
get "reports/similar_users" => "reports#similar_users"
|
||||||
|
get "reports/post_versions" => "reports#post_versions"
|
||||||
|
post "reports/post_versions_create" => "reports#post_versions_create"
|
||||||
resources :saved_searches, :except => [:show] do
|
resources :saved_searches, :except => [:show] do
|
||||||
collection do
|
collection do
|
||||||
get :categories
|
get :categories
|
||||||
|
|||||||
Reference in New Issue
Block a user