Merge pull request #2879 from evazion/fix-dead-code
Eliminate dead code
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
div#c-landings {
|
||||
div#a-show {
|
||||
padding-top: 4em;
|
||||
width: 960px;
|
||||
margin: auto;
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
p.slogan {
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.column {
|
||||
width: 480px;
|
||||
vertical-align: top;
|
||||
float: left;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
div.landing-post {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.landing-post:hover img {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
div.landing-post:hover div.data {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
div.landing-post div.data {
|
||||
position: absolute;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class LandingsController < ApplicationController
|
||||
def show
|
||||
@explorer = PopularPostExplorer.new
|
||||
render :layout => "blank"
|
||||
end
|
||||
end
|
||||
@@ -15,7 +15,7 @@ module Moderator
|
||||
end
|
||||
|
||||
::Post.without_timeout do
|
||||
@posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => params[:query]).paginate(params[:page], :limit => per_page)
|
||||
@posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).tag_match(params[:query]).paginate(params[:page], :limit => per_page)
|
||||
@posts.each # hack to force rails to eager load
|
||||
end
|
||||
respond_with(@posts)
|
||||
|
||||
@@ -83,14 +83,6 @@ class PostsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def home
|
||||
if CurrentUser.user.is_anonymous?
|
||||
redirect_to intro_explore_posts_path
|
||||
else
|
||||
redirect_to posts_path(:tags => params[:tags])
|
||||
end
|
||||
end
|
||||
|
||||
def random
|
||||
count = Post.fast_count(params[:tags], :statement_timeout => CurrentUser.user.statement_timeout)
|
||||
@post = Post.tag_match(params[:tags]).random
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
module BansHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module CommentVotesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module CommentsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module FavoritesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module ForumPostsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module ForumTopicVisitsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module JanitorTrialsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module LandingsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module NewsUpdatesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module NotesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module PostVotesHelper
|
||||
end
|
||||
@@ -40,24 +40,6 @@ module PostsHelper
|
||||
render("users/common_searches", user: user, sig: sig)
|
||||
end
|
||||
|
||||
def resize_image_links(post, user)
|
||||
links = []
|
||||
|
||||
if post.has_large?
|
||||
links << link_to("L", post.large_file_url, :id => "large-file-link")
|
||||
end
|
||||
|
||||
if post.has_large?
|
||||
links << link_to("O", post.file_url, :id => "original-file-link")
|
||||
end
|
||||
|
||||
if links.any?
|
||||
content_tag("span", raw("Resize: " + links.join(" ")))
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def post_source_tag(post)
|
||||
if post.source =~ %r!\Ahttp://img\d+\.pixiv\.net/img/([^\/]+)/!i
|
||||
text = "pixiv/<wbr>#{wordbreakify($1)}".html_safe
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
module RelatedTagsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module SessionsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module TagAliasesHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module TagImplicationsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module TagSubscriptionsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module UnapprovalsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module UploadsHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module UserFeedbackHelper
|
||||
end
|
||||
@@ -39,19 +39,5 @@ module PostSets
|
||||
def presenter
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def arbitrary_sql_order_clause(ids, table_name)
|
||||
if ids.empty?
|
||||
return "#{table_name}.id desc"
|
||||
end
|
||||
|
||||
conditions = []
|
||||
|
||||
ids.each_with_index do |x, n|
|
||||
conditions << "when #{x} then #{n}"
|
||||
end
|
||||
|
||||
"case #{table_name}.id " + conditions.join(" ") + " end"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,10 +158,6 @@ class ForumTopic < ActiveRecord::Base
|
||||
(response_count / Danbooru.config.posts_per_page.to_f).ceil
|
||||
end
|
||||
|
||||
def presenter(forum_posts)
|
||||
@presenter ||= ForumTopicPresenter.new(self, forum_posts)
|
||||
end
|
||||
|
||||
def as_json(options = {})
|
||||
if CurrentUser.user.level < min_level
|
||||
options[:only] = [:id]
|
||||
|
||||
@@ -89,10 +89,6 @@ class Note < ActiveRecord::Base
|
||||
extend SearchMethods
|
||||
include ApiMethods
|
||||
|
||||
def presenter
|
||||
@presenter ||= NotePresenter.new(self)
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id ||= CurrentUser.id
|
||||
end
|
||||
|
||||
@@ -531,10 +531,6 @@ class Post < ActiveRecord::Base
|
||||
@tag_array_was ||= Tag.scan_tags(tag_string_was)
|
||||
end
|
||||
|
||||
def increment_tag_post_counts
|
||||
Tag.where(:name => tag_array).update_all("post_count = post_count + 1") if tag_array.any?
|
||||
end
|
||||
|
||||
def decrement_tag_post_counts
|
||||
Tag.where(:name => tag_array).update_all("post_count = post_count - 1") if tag_array.any?
|
||||
end
|
||||
@@ -1476,10 +1472,6 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module NoteMethods
|
||||
def last_noted_at_as_integer
|
||||
last_noted_at.to_i
|
||||
end
|
||||
|
||||
def has_notes?
|
||||
last_noted_at.present?
|
||||
end
|
||||
@@ -1616,10 +1608,6 @@ class Post < ActiveRecord::Base
|
||||
where("is_deleted = ?", true)
|
||||
end
|
||||
|
||||
def commented_before(date)
|
||||
where("last_commented_at < ?", date).order("last_commented_at DESC")
|
||||
end
|
||||
|
||||
def has_notes
|
||||
where("last_noted_at is not null")
|
||||
end
|
||||
@@ -1636,10 +1624,6 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def hidden_from_moderation
|
||||
where("id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id)
|
||||
end
|
||||
|
||||
def raw_tag_match(tag)
|
||||
where("posts.tag_index @@ to_tsquery('danbooru', E?)", tag.to_escaped_for_tsquery)
|
||||
end
|
||||
@@ -1656,53 +1640,6 @@ class Post < ActiveRecord::Base
|
||||
PostQueryBuilder.new(query).build
|
||||
end
|
||||
end
|
||||
|
||||
def positive
|
||||
where("score > 1")
|
||||
end
|
||||
|
||||
def negative
|
||||
where("score < -1")
|
||||
end
|
||||
|
||||
def updater_name_matches(name)
|
||||
where("updater_id = (select _.id from users _ where lower(_.name) = ?)", name.mb_chars.downcase)
|
||||
end
|
||||
|
||||
def after_id(num)
|
||||
if num.present?
|
||||
where("id > ?", num.to_i).reorder("id asc")
|
||||
else
|
||||
where("true")
|
||||
end
|
||||
end
|
||||
|
||||
def before_id(num)
|
||||
if num.present?
|
||||
where("id < ?", num.to_i).reorder("id desc")
|
||||
else
|
||||
where("true")
|
||||
end
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = where("true")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:before_id].present?
|
||||
q = q.before_id(params[:before_id].to_i)
|
||||
end
|
||||
|
||||
if params[:after_id].present?
|
||||
q = q.after_id(params[:after_id].to_i)
|
||||
end
|
||||
|
||||
if params[:tag_match].present?
|
||||
q = q.tag_match(params[:tag_match])
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
end
|
||||
|
||||
module PixivMethods
|
||||
|
||||
@@ -56,10 +56,6 @@ class PostVersion < ActiveRecord::Base
|
||||
@tag_array ||= tags.scan(/\S+/)
|
||||
end
|
||||
|
||||
def presenter
|
||||
PostVersionPresenter.new(self)
|
||||
end
|
||||
|
||||
def reload
|
||||
@tag_array = nil
|
||||
super
|
||||
|
||||
@@ -79,12 +79,6 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module ViewCountMethods
|
||||
def increment_view_count(name)
|
||||
Cache.incr("tvc:#{Cache.sanitize(name)}")
|
||||
end
|
||||
end
|
||||
|
||||
module CategoryMethods
|
||||
module ClassMethods
|
||||
def categories
|
||||
@@ -694,20 +688,6 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module SuggestionMethods
|
||||
def find_suggestions(query)
|
||||
query_tokens = query.split(/_/)
|
||||
|
||||
if query_tokens.size == 2
|
||||
search_for = query_tokens.reverse.join("_").to_escaped_for_sql_like
|
||||
else
|
||||
search_for = "%" + query.to_escaped_for_sql_like + "%"
|
||||
end
|
||||
|
||||
Tag.where(["name LIKE ? ESCAPE E'\\\\' AND post_count > 0 AND name <> ?", search_for, query]).order("post_count DESC").limit(6).select("name").map(&:name).sort
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def name_matches(name)
|
||||
where("tags.name LIKE ? ESCAPE E'\\\\'", name.mb_chars.downcase.to_escaped_for_sql_like)
|
||||
@@ -789,12 +769,10 @@ class Tag < ActiveRecord::Base
|
||||
|
||||
include ApiMethods
|
||||
include CountMethods
|
||||
extend ViewCountMethods
|
||||
include CategoryMethods
|
||||
extend StatisticsMethods
|
||||
extend NameMethods
|
||||
extend ParseMethods
|
||||
include RelationMethods
|
||||
extend SuggestionMethods
|
||||
extend SearchMethods
|
||||
end
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
class ForumTopicPresenter < Presenter
|
||||
attr_reader :forum_topic, :forum_posts
|
||||
|
||||
def initialize(forum_topic, forum_posts)
|
||||
@forum_posts = forum_posts
|
||||
@forum_topic = forum_topic
|
||||
end
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
class NotePresenter
|
||||
def initialize(note)
|
||||
@note = note
|
||||
end
|
||||
|
||||
def formatted_body
|
||||
note.body.gsub(/<tn>(.+?)<\/tn>/m, '<br><p class="tn">\1</p>').gsub(/\n/, '<br>')
|
||||
end
|
||||
end
|
||||
@@ -1,20 +0,0 @@
|
||||
class PostVersionPresenter < Presenter
|
||||
attr_reader :post_version
|
||||
|
||||
def initialize(post_version)
|
||||
@post_version = post_version
|
||||
end
|
||||
|
||||
def changes
|
||||
html = []
|
||||
html << post_version.tag_array
|
||||
html << "<ins>source:#{h(post_version.source)}</ins>" if post_version.source
|
||||
html << "<ins>rating:#{h(post_version.rating)}</ins>" if post_version.rating
|
||||
html << "<ins>parent:#{post_version.parent_id}</ins>" if post_version.parent_id
|
||||
html.join(" ").html_safe
|
||||
end
|
||||
|
||||
def updater_name
|
||||
User.id_to_name(post_version.updater_id)
|
||||
end
|
||||
end
|
||||
@@ -33,22 +33,6 @@ module Danbooru
|
||||
connection.__send__(method_name, sanitize_sql_array([sql, *params]))
|
||||
end
|
||||
end
|
||||
|
||||
def arbitrary_sql_order_clause(ids, table_name = nil)
|
||||
table_name = self.class.table_name if table_name.nil?
|
||||
|
||||
if ids.empty?
|
||||
return "#{table_name}.id desc"
|
||||
end
|
||||
|
||||
conditions = []
|
||||
|
||||
ids.each_with_index do |x, n|
|
||||
conditions << "when #{x} then #{n}"
|
||||
end
|
||||
|
||||
"case #{table_name}.id " + conditions.join(" ") + " end"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,10 +12,6 @@ module Danbooru
|
||||
def to_escaped_for_tsquery
|
||||
"'#{gsub(/\0/, '').gsub(/'/, '\0\0').gsub(/\\/, '\0\0\0\0')}'"
|
||||
end
|
||||
|
||||
def to_escaped_js
|
||||
return self.gsub(/\\/, '\0\0').gsub(/['"]/) {|m| "\\#{m}"}.gsub(/\r\n|\r|\n/, '\\n')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,7 +160,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
resources :jobs
|
||||
resource :landing
|
||||
resources :mod_actions
|
||||
resources :news_updates
|
||||
resources :notes do
|
||||
@@ -197,7 +196,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resource :votes, :controller => "post_votes", :only => [:create, :destroy]
|
||||
collection do
|
||||
get :home
|
||||
get :random
|
||||
end
|
||||
member do
|
||||
|
||||
Reference in New Issue
Block a user