about summary refs log tree commit diff
path: root/app/models/domain_block.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-02-19 20:18:40 +0100
committerThibaut Girka <thib@sitedethib.com>2019-02-19 20:18:40 +0100
commitff0576cc2b046694dd8960608ce2f40e32a0ab78 (patch)
tree766b37f3f093f3882aba2258ebc2748325edcfcb /app/models/domain_block.rb
parent896beb16c5318b8ce59867a06545ae6a00ccc84c (diff)
parent8e7fc7ec73c0743df378403ad2e704c9fae70400 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/models/domain_block.rb')
-rw-r--r--app/models/domain_block.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 1064ea7c8..069cda367 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -24,6 +24,8 @@ class DomainBlock < ApplicationRecord
   has_many :accounts, foreign_key: :domain, primary_key: :domain
   delegate :count, to: :accounts, prefix: true
 
+  scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
+
   def self.blocked?(domain)
     where(domain: domain, severity: :suspend).exists?
   end