Remove counts controller

This commit is contained in:
Kira 2019-09-19 15:40:05 -07:00
parent 4440dacfe6
commit e42324dd03
6 changed files with 1 additions and 44 deletions

View File

@ -1,13 +0,0 @@
class CountsController < ApplicationController
respond_to :xml, :json
rescue_from Post::TimeoutError, with: :rescue_exception
def posts
@count = Post.fast_count(
params[:tags],
timeout: CurrentUser.statement_timeout,
raise_on_timeout: true,
skip_cache: params[:skip_cache]
)
end
end

View File

@ -1,16 +0,0 @@
<div id="c-counts">
<div id="a-posts">
Post count for <%= link_to params[:tags].present? ? params[:tags] : "/posts", posts_path(:tags => params[:tags]) %>:
<% if @count == (Danbooru.config.blank_tag_search_fast_count || 1_000_000) %>
timed out
<% else %>
<%= @count %>
<% end %>
</div>
</div>
<% content_for(:page_title) do %>
Post Counts - <%= Danbooru.config.app_name %>
<% end %>
<%= render "posts/partials/common/secondary_links" %>

View File

@ -1 +0,0 @@
{"counts": {"posts": <%= @count %>}}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<counts>
<posts>
<%= @count %>
</posts>
</counts>

View File

@ -1,7 +1,7 @@
<section id="related-box">
<h1>Related</h1>
<ul id="related-list">
<% if discover_mode? %>
<% if discover_mode? %>
<li id="secondary-links-posts-hot"><%= link_to "Hot", posts_path(:tags => "order:rank") %></li>
<li id="secondary-links-posts-popular"><%= link_to "Popular", popular_explore_posts_path %></li>
<% if PopularSearchService.enabled? %>
@ -17,7 +17,5 @@
<% end %>
<li><%= link_to "Random", random_posts_path(:tags => params[:tags]), :id => "random-post", :rel => "nofollow", :"data-shortcut" => "r" %></li>
<li><%= link_to "Count", posts_counts_path(:tags => params[:tags]) %></li>
</ul>
</section>

View File

@ -141,11 +141,6 @@ Rails.application.routes.draw do
post :delete
end
end
resources :counts do
collection do
get :posts
end
end
resources :delayed_jobs, :only => [:index, :destroy] do
member do
put :run