/janitor_trials, /ip_bans: fix default ordering.
This commit is contained in:
@@ -13,8 +13,7 @@ class JanitorTrialsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = JanitorTrial.search(params[:search])
|
@janitor_trials = JanitorTrial.search(params[:search]).paginate(params[:page], :limit => params[:limit])
|
||||||
@janitor_trials = @search.paginate(params[:page], :limit => params[:limit])
|
|
||||||
respond_with(@janitor_trials)
|
respond_with(@janitor_trials)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,13 @@ class IpBan < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.search(params)
|
def self.search(params)
|
||||||
q = where("true")
|
q = super
|
||||||
return q if params.blank?
|
|
||||||
|
|
||||||
if params[:ip_addr].present?
|
if params[:ip_addr].present?
|
||||||
q = q.where("ip_addr = ?", params[:ip_addr])
|
q = q.where("ip_addr = ?", params[:ip_addr])
|
||||||
end
|
end
|
||||||
|
|
||||||
q
|
q.apply_default_order(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.query(user_ids)
|
def self.query(user_ids)
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ class JanitorTrial < ApplicationRecord
|
|||||||
validates_uniqueness_of :user_id
|
validates_uniqueness_of :user_id
|
||||||
|
|
||||||
def self.search(params)
|
def self.search(params)
|
||||||
q = where("status = ?", "active")
|
q = super.where(status: "active")
|
||||||
return q if params.blank?
|
|
||||||
|
|
||||||
if params[:user_name]
|
if params[:user_name]
|
||||||
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].mb_chars.downcase)
|
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].mb_chars.downcase)
|
||||||
@@ -21,7 +20,7 @@ class JanitorTrial < ApplicationRecord
|
|||||||
q = q.where("user_id = ?", params[:user_id].to_i)
|
q = q.where("user_id = ?", params[:user_id].to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
q
|
q.apply_default_order(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.message_candidates!
|
def self.message_candidates!
|
||||||
|
|||||||
Reference in New Issue
Block a user