Adding a block model and filter mentions from blocked users (fix #60)
This commit is contained in:
parent
a488b05726
commit
9d59d7b463
11 changed files with 55 additions and 12 deletions
|
@ -33,8 +33,12 @@ class Account < ApplicationRecord
|
|||
has_many :active_relationships, class_name: 'Follow', foreign_key: 'account_id', dependent: :destroy
|
||||
has_many :passive_relationships, class_name: 'Follow', foreign_key: 'target_account_id', dependent: :destroy
|
||||
|
||||
has_many :following, through: :active_relationships, source: :target_account
|
||||
has_many :followers, through: :passive_relationships, source: :account
|
||||
has_many :following, -> { order('follows.created_at desc') }, through: :active_relationships, source: :target_account
|
||||
has_many :followers, -> { order('follows.created_at desc') }, through: :passive_relationships, source: :account
|
||||
|
||||
# Block relationships
|
||||
has_many :block_relationships, class_name: 'Block', foreign_key: 'account_id', dependent: :destroy
|
||||
has_many :blocking, -> { order('blocks.created_at desc') }, through: :block_relationships, source: :target_account
|
||||
|
||||
has_many :media_attachments, dependent: :destroy
|
||||
|
||||
|
@ -57,6 +61,10 @@ class Account < ApplicationRecord
|
|||
following.include?(other_account)
|
||||
end
|
||||
|
||||
def blocking?(other_account)
|
||||
blocking.include?(other_account)
|
||||
end
|
||||
|
||||
def local?
|
||||
domain.nil?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue