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.

68 lines
1.7 KiB

  1. # frozen_string_literal: true
  2. class AboutController < ApplicationController
  3. include RegistrationSpamConcern
  4. layout 'public'
  5. before_action :require_open_federation!, only: [:show, :more]
  6. before_action :set_body_classes, only: :show
  7. before_action :set_instance_presenter
  8. before_action :set_expires_in, only: [:more, :terms]
  9. before_action :set_registration_form_time, only: :show
  10. skip_before_action :require_functional!, only: [:more, :terms]
  11. def show; end
  12. def more
  13. flash.now[:notice] = I18n.t('about.instance_actor_flash') if params[:instance_actor]
  14. toc_generator = TOCGenerator.new(@instance_presenter.site_extended_description)
  15. @rules = Rule.ordered
  16. @contents = toc_generator.html
  17. @table_of_contents = toc_generator.toc
  18. @blocks = DomainBlock.with_user_facing_limitations.by_severity if display_blocks?
  19. end
  20. def terms; end
  21. helper_method :display_blocks?
  22. helper_method :display_blocks_rationale?
  23. helper_method :public_fetch_mode?
  24. helper_method :new_user
  25. private
  26. def require_open_federation!
  27. not_found if whitelist_mode?
  28. end
  29. def display_blocks?
  30. Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
  31. end
  32. def display_blocks_rationale?
  33. Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?)
  34. end
  35. def new_user
  36. User.new.tap do |user|
  37. user.build_account
  38. user.build_invite_request
  39. end
  40. end
  41. def set_instance_presenter
  42. @instance_presenter = InstancePresenter.new
  43. end
  44. def set_body_classes
  45. @hide_navbar = true
  46. end
  47. def set_expires_in
  48. expires_in 0, public: true
  49. end
  50. end