Adding domain blocks
This commit is contained in:
@ -24,10 +24,10 @@ class Account < ApplicationRecord
|
||||
validates :note, length: { maximum: 124 }, if: 'local?'
|
||||
|
||||
# Timelines
|
||||
has_many :stream_entries, inverse_of: :account
|
||||
has_many :statuses, inverse_of: :account
|
||||
has_many :favourites, inverse_of: :account
|
||||
has_many :mentions, inverse_of: :account
|
||||
has_many :stream_entries, inverse_of: :account, dependent: :destroy
|
||||
has_many :statuses, inverse_of: :account, dependent: :destroy
|
||||
has_many :favourites, inverse_of: :account, dependent: :destroy
|
||||
has_many :mentions, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Follow relations
|
||||
has_many :active_relationships, class_name: 'Follow', foreign_key: 'account_id', dependent: :destroy
|
||||
|
7
app/models/domain_block.rb
Normal file
7
app/models/domain_block.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class DomainBlock < ApplicationRecord
|
||||
validates :domain, presence: true, uniqueness: true
|
||||
|
||||
def self.blocked?(domain)
|
||||
where(domain: domain).exists?
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user