search: refactor to pass in the current user explicitly.
This commit is contained in:
@@ -18,8 +18,8 @@ class Ban < ApplicationRecord
|
||||
scope :expired, -> { where("bans.created_at + bans.duration <= ?", Time.zone.now) }
|
||||
scope :active, -> { unexpired }
|
||||
|
||||
def self.search(params)
|
||||
q = search_attributes(params, :id, :created_at, :updated_at, :duration, :reason, :user, :banner)
|
||||
def self.search(params, current_user)
|
||||
q = search_attributes(params, [:id, :created_at, :updated_at, :duration, :reason, :user, :banner], current_user: current_user)
|
||||
|
||||
q = q.expired if params[:expired].to_s.truthy?
|
||||
q = q.unexpired if params[:expired].to_s.falsy?
|
||||
|
||||
Reference in New Issue
Block a user