Class: Fedipub::Moderation::DomainBlock

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/fedipub/moderation/domain_block.rb

Class Method Summary collapse

Class Method Details

.blocked?(query) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
# File 'app/models/fedipub/moderation/domain_block.rb', line 5

def self.blocked?(query)
  self.exists?(domain: [ query, PublicSuffix.parse(query).domain ])
rescue PublicSuffix::Error
  # Allow things that we don't understand
  false
end