You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
778 B

  1. # frozen_string_literal: true
  2. class DirectoriesController < ApplicationController
  3. layout 'public'
  4. before_action :authenticate_user!, if: :whitelist_mode?
  5. before_action :require_enabled!
  6. before_action :set_instance_presenter
  7. before_action :set_accounts
  8. skip_before_action :require_functional!, unless: :whitelist_mode?
  9. def index
  10. render :index
  11. end
  12. private
  13. def require_enabled!
  14. return not_found unless Setting.profile_directory
  15. end
  16. def set_accounts
  17. @accounts = Account.local.discoverable.by_recent_status.page(params[:page]).per(20).tap do |query|
  18. query.merge!(Account.not_excluded_by_account(current_account)) if current_account
  19. end
  20. end
  21. def set_instance_presenter
  22. @instance_presenter = InstancePresenter.new
  23. end
  24. end