Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
This commit is contained in:
@@ -7,7 +7,7 @@ module Moderator
|
||||
.where("artist_versions.created_at > ?", min_date)
|
||||
.where("users.level <= ?", max_level)
|
||||
.group(:updater)
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
.count
|
||||
.map { |user, count| new(user, count) }
|
||||
|
||||
@@ -9,7 +9,7 @@ module Moderator
|
||||
.where("users.level <= ?", max_level)
|
||||
.group(:comment)
|
||||
.having("count(*) >= 3")
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
.count
|
||||
.map { |comment, count| new(comment, count) }
|
||||
|
||||
@@ -7,7 +7,7 @@ module Moderator
|
||||
.where("note_versions.created_at > ?", min_date)
|
||||
.where("users.level <= ?", max_level)
|
||||
.group(:updater)
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
.count
|
||||
.map { |user, count| new(user, count) }
|
||||
|
||||
@@ -7,7 +7,7 @@ module Moderator
|
||||
.deleted
|
||||
.where("post_appeals.created_at > ?", min_date)
|
||||
.group(:id)
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ module Moderator
|
||||
.where("posts.created_at > ?", min_date)
|
||||
.where("users.level <= ?", max_level)
|
||||
.group(:uploader)
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
.count
|
||||
.map { |user, count| new(user, count) }
|
||||
|
||||
@@ -7,7 +7,7 @@ module Moderator
|
||||
.where("wiki_page_versions.created_at > ?", min_date)
|
||||
.where("users.level <= ?", max_level)
|
||||
.group(:updater)
|
||||
.order("count(*) desc")
|
||||
.order(Arel.sql("count(*) desc"))
|
||||
.limit(10)
|
||||
.count
|
||||
.map { |user, count| new(user, count) }
|
||||
|
||||
@@ -363,7 +363,7 @@ class PostQueryBuilder
|
||||
|
||||
if q[:ordpool].present?
|
||||
pool_id = q[:ordpool].to_i
|
||||
relation = relation.order("position(' '||posts.id||' ' in ' '||(select post_ids from pools where id = #{pool_id})||' ')")
|
||||
relation = relation.order(Arel.sql("position(' '||posts.id||' ' in ' '||(select post_ids from pools where id = #{pool_id})||' ')"))
|
||||
end
|
||||
|
||||
if q[:favgroups_neg].present?
|
||||
@@ -479,20 +479,20 @@ class PostQueryBuilder
|
||||
relation = relation.order("artist_commentaries.updated_at ASC")
|
||||
|
||||
when "mpixels", "mpixels_desc"
|
||||
relation = relation.where("posts.image_width is not null and posts.image_height is not null")
|
||||
relation = relation.where(Arel.sql("posts.image_width is not null and posts.image_height is not null"))
|
||||
# Use "w*h/1000000", even though "w*h" would give the same result, so this can use
|
||||
# the posts_mpixels index.
|
||||
relation = relation.order("posts.image_width * posts.image_height / 1000000.0 DESC")
|
||||
relation = relation.order(Arel.sql("posts.image_width * posts.image_height / 1000000.0 DESC"))
|
||||
|
||||
when "mpixels_asc"
|
||||
relation = relation.where("posts.image_width is not null and posts.image_height is not null")
|
||||
relation = relation.order("posts.image_width * posts.image_height / 1000000.0 ASC")
|
||||
relation = relation.order(Arel.sql("posts.image_width * posts.image_height / 1000000.0 ASC"))
|
||||
|
||||
when "portrait"
|
||||
relation = relation.order("1.0 * posts.image_width / GREATEST(1, posts.image_height) ASC")
|
||||
relation = relation.order(Arel.sql("1.0 * posts.image_width / GREATEST(1, posts.image_height) ASC"))
|
||||
|
||||
when "landscape"
|
||||
relation = relation.order("1.0 * posts.image_width / GREATEST(1, posts.image_height) DESC")
|
||||
relation = relation.order(Arel.sql("1.0 * posts.image_width / GREATEST(1, posts.image_height) DESC"))
|
||||
|
||||
when "filesize", "filesize_desc"
|
||||
relation = relation.order("posts.file_size DESC")
|
||||
@@ -513,7 +513,7 @@ class PostQueryBuilder
|
||||
relation = relation.order("posts.tag_count_#{TagCategory.short_name_mapping[$1]} ASC")
|
||||
|
||||
when "rank"
|
||||
relation = relation.order("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 35000 DESC")
|
||||
relation = relation.order(Arel.sql("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 35000 DESC"))
|
||||
|
||||
when "custom"
|
||||
if q[:post_id].present? && q[:post_id][0] == :in
|
||||
|
||||
@@ -17,7 +17,7 @@ class BulkUpdateRequest < ApplicationRecord
|
||||
before_validation :normalize_text
|
||||
after_create :create_forum_topic
|
||||
|
||||
scope :pending_first, lambda { order("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)") }
|
||||
scope :pending_first, lambda { order(Arel.sql("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)")) }
|
||||
scope :pending, ->{where(status: "pending")}
|
||||
scope :expired, ->{where("created_at < ?", TagRelationship::EXPIRY.days.ago)}
|
||||
scope :old, ->{where("created_at between ? and ?", TagRelationship::EXPIRY.days.ago, TagRelationship::EXPIRY_WARNING.days.ago)}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Pool < ApplicationRecord
|
||||
end
|
||||
|
||||
def series_first
|
||||
order("(case pools.category when 'series' then 0 else 1 end), pools.name")
|
||||
order(Arel.sql("(case pools.category when 'series' then 0 else 1 end), pools.name"))
|
||||
end
|
||||
|
||||
def name_matches(name)
|
||||
|
||||
@@ -73,7 +73,7 @@ class SavedSearch < ApplicationRecord
|
||||
|
||||
def self.labels_for(user_id)
|
||||
Cache.get(cache_key(user_id)) do
|
||||
SavedSearch.where(user_id: user_id).order("label").pluck("distinct unnest(labels) as label")
|
||||
SavedSearch.where(user_id: user_id).order("label").pluck(Arel.sql("distinct unnest(labels) as label"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class TagRelationship < ApplicationRecord
|
||||
end
|
||||
|
||||
def pending_first
|
||||
order("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name")
|
||||
order(Arel.sql("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name"))
|
||||
end
|
||||
|
||||
def active
|
||||
|
||||
Reference in New Issue
Block a user