Convert models to use new search includes mechanism

This commit is contained in:
BrokenEagle
2020-07-19 03:42:51 +00:00
parent c141a358bd
commit c4009efccd
36 changed files with 208 additions and 125 deletions

View File

@@ -18,7 +18,7 @@ class Ban < ApplicationRecord
def self.search(params)
q = super
q = q.search_attributes(params, :banner, :user, :expires_at, :reason)
q = q.search_attributes(params, :expires_at, :reason)
q = q.text_attribute_matches(:reason, params[:reason_matches])
q = q.expired if params[:expired].to_s.truthy?
@@ -91,6 +91,10 @@ class Ban < ApplicationRecord
ModAction.log(%{Unbanned <@#{user_name}>}, :user_unban)
end
def self.searchable_includes
[:user, :banner]
end
def self.available_includes
[:user, :banner]
end