where i deviate from standard mastodon assets
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

instance_filter.rb 717B

123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. class InstanceFilter
  3. KEYS = %i(
  4. limited
  5. by_domain
  6. ).freeze
  7. attr_reader :params
  8. def initialize(params)
  9. @params = params
  10. end
  11. def results
  12. if params[:limited].present?
  13. scope = DomainBlock
  14. scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
  15. scope.order(id: :desc)
  16. elsif params[:allowed].present?
  17. scope = DomainAllow
  18. scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
  19. scope.order(id: :desc)
  20. else
  21. scope = Account.remote
  22. scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
  23. scope.by_domain_accounts
  24. end
  25. end
  26. end