Merge branch 'master' into glitch-soc/merge-upstream
This commit is contained in:
@@ -30,7 +30,8 @@ class AccountConversation < ApplicationRecord
|
||||
if participant_account_ids.empty?
|
||||
[account]
|
||||
else
|
||||
Account.where(id: participant_account_ids)
|
||||
participants = Account.where(id: participant_account_ids)
|
||||
participants.empty? ? [account] : participants
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,9 +9,13 @@ class InstanceFilter
|
||||
|
||||
def results
|
||||
if params[:limited].present?
|
||||
DomainBlock.order(id: :desc)
|
||||
scope = DomainBlock
|
||||
scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
|
||||
scope.order(id: :desc)
|
||||
else
|
||||
Account.remote.by_domain_accounts
|
||||
scope = Account.remote
|
||||
scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
|
||||
scope.by_domain_accounts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user