Fix various rubocop issues.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module Danbooru
|
||||
class Http
|
||||
attr_accessor :cache, :http
|
||||
attr_writer :cache, :http
|
||||
|
||||
class << self
|
||||
delegate :get, :post, :delete, :cache, :auth, :basic_auth, :headers, to: :new
|
||||
|
||||
@@ -40,9 +40,7 @@ class PostQueryBuilder
|
||||
end
|
||||
|
||||
def escape_string_for_tsquery(array)
|
||||
array.map do |token|
|
||||
token.to_escaped_for_tsquery
|
||||
end
|
||||
array.map(&:to_escaped_for_tsquery)
|
||||
end
|
||||
|
||||
def add_tag_string_search_relation(tags, relation)
|
||||
@@ -314,7 +312,7 @@ class PostQueryBuilder
|
||||
elsif flagger_id == "none"
|
||||
relation = relation.where('NOT EXISTS (' + PostFlag.unscoped.search(:category => "normal").where('post_id = posts.id').reorder('').select('1').to_sql + ')')
|
||||
elsif CurrentUser.can_view_flagger?(flagger_id)
|
||||
post_ids = PostFlag.unscoped.search(:creator_id => flagger_id, :category => "normal").reorder("").select {|flag| flag.not_uploaded_by?(CurrentUser.id)}.map {|flag| flag.post_id}.uniq
|
||||
post_ids = PostFlag.unscoped.search(creator_id: flagger_id, category: "normal").reorder("").select {|flag| flag.not_uploaded_by?(CurrentUser.id)}.map(&:post_id).uniq
|
||||
relation = relation.where("posts.id": post_ids)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,11 +78,11 @@ module PostSets
|
||||
end
|
||||
|
||||
def hidden_posts
|
||||
posts.reject { |p| p.visible? }
|
||||
posts.reject(&:visible?)
|
||||
end
|
||||
|
||||
def banned_posts
|
||||
posts.select { |p| p.banblocked? }
|
||||
posts.select(&:banblocked?)
|
||||
end
|
||||
|
||||
def censored_posts
|
||||
|
||||
@@ -11,8 +11,8 @@ class PostVoteSimilarity
|
||||
@score = score
|
||||
end
|
||||
|
||||
def <=>(rhs)
|
||||
score <=> rhs.score
|
||||
def <=>(other)
|
||||
score <=> other.score
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -240,11 +240,6 @@ module Sources
|
||||
self.class.to_dtext(artist_commentary_desc)
|
||||
end
|
||||
|
||||
# A strategy may return extra data unrelated to the file
|
||||
def data
|
||||
return {}
|
||||
end
|
||||
|
||||
# A search query that should return any posts that were previously
|
||||
# uploaded from the same source. These may be duplicates, or they may be
|
||||
# other posts from the same gallery.
|
||||
|
||||
@@ -139,7 +139,7 @@ module Sources::Strategies
|
||||
|
||||
def normalize_tag(tag)
|
||||
COMMON_TAG_REGEXES.each do |rg|
|
||||
norm_tag = tag.gsub(rg,"")
|
||||
norm_tag = tag.gsub(rg, "")
|
||||
if norm_tag != tag
|
||||
return norm_tag
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class TableBuilder
|
||||
@block = block
|
||||
|
||||
@name = name || attribute
|
||||
@name = @name.to_s.titleize unless @name.kind_of?(String)
|
||||
@name = @name.to_s.titleize unless @name.is_a?(String)
|
||||
|
||||
if @name.present?
|
||||
column_class = "#{@name.parameterize.dasherize}-column"
|
||||
@@ -22,7 +22,7 @@ class TableBuilder
|
||||
if block.present?
|
||||
block.call(item, i, j, self)
|
||||
nil
|
||||
elsif attribute.kind_of?(Symbol)
|
||||
elsif attribute.is_a?(Symbol)
|
||||
item.send(attribute)
|
||||
else
|
||||
""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module TagRelationshipRetirementService
|
||||
module_function
|
||||
|
||||
THRESHOLD = 2.years
|
||||
|
||||
def forum_topic_title
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class UploadService
|
||||
module Utils
|
||||
module_function
|
||||
|
||||
class CorruptFileError < RuntimeError; end
|
||||
|
||||
def file_header_to_file_ext(file)
|
||||
|
||||
Reference in New Issue
Block a user