Create DomainNormalizable#normalize_domain (#9631)
This commit is contained in:
parent
bf70e5cfda
commit
0c1e4bb969
4 changed files with 20 additions and 17 deletions
|
@ -13,6 +13,8 @@
|
|||
#
|
||||
|
||||
class DomainBlock < ApplicationRecord
|
||||
include DomainNormalizable
|
||||
|
||||
enum severity: [:silence, :suspend, :noop]
|
||||
|
||||
attr_accessor :retroactive
|
||||
|
@ -25,12 +27,4 @@ class DomainBlock < ApplicationRecord
|
|||
def self.blocked?(domain)
|
||||
where(domain: domain, severity: :suspend).exists?
|
||||
end
|
||||
|
||||
before_validation :normalize_domain
|
||||
|
||||
private
|
||||
|
||||
def normalize_domain
|
||||
self.domain = TagManager.instance.normalize_domain(domain)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue