Fix rails rewhere deprecation warning in directories api controller (#25625)
				
					
				
			This commit is contained in:
		@@ -21,11 +21,35 @@ class Api::V1::DirectoriesController < Api::BaseController
 | 
			
		||||
 | 
			
		||||
  def accounts_scope
 | 
			
		||||
    Account.discoverable.tap do |scope|
 | 
			
		||||
      scope.merge!(Account.local)                                          if truthy_param?(:local)
 | 
			
		||||
      scope.merge!(Account.by_recent_status)                               if params[:order].blank? || params[:order] == 'active'
 | 
			
		||||
      scope.merge!(Account.order(id: :desc))                               if params[:order] == 'new'
 | 
			
		||||
      scope.merge!(Account.not_excluded_by_account(current_account))       if current_account
 | 
			
		||||
      scope.merge!(Account.not_domain_blocked_by_account(current_account)) if current_account && !truthy_param?(:local)
 | 
			
		||||
      scope.merge!(account_order_scope)
 | 
			
		||||
      scope.merge!(local_account_scope) if local_accounts?
 | 
			
		||||
      scope.merge!(account_exclusion_scope) if current_account
 | 
			
		||||
      scope.merge!(account_domain_block_scope) if current_account && !local_accounts?
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def local_accounts?
 | 
			
		||||
    truthy_param?(:local)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def account_order_scope
 | 
			
		||||
    case params[:order]
 | 
			
		||||
    when 'new'
 | 
			
		||||
      Account.order(id: :desc)
 | 
			
		||||
    when 'active', nil
 | 
			
		||||
      Account.by_recent_status
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def local_account_scope
 | 
			
		||||
    Account.local
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def account_exclusion_scope
 | 
			
		||||
    Account.not_excluded_by_account(current_account)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def account_domain_block_scope
 | 
			
		||||
    Account.not_domain_blocked_by_account(current_account)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user