闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
398 B

  1. # frozen_string_literal: true
  2. class DomainBlock < ApplicationRecord
  3. enum severity: [:silence, :suspend]
  4. attr_accessor :retroactive
  5. validates :domain, presence: true, uniqueness: true
  6. has_many :accounts, foreign_key: :domain, primary_key: :domain
  7. delegate :count, to: :accounts, prefix: true
  8. def self.blocked?(domain)
  9. where(domain: domain, severity: :suspend).exists?
  10. end
  11. end