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.

67 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. @contents = toc_generator.html
  16. @table_of_contents = toc_generator.toc
  17. @blocks = DomainBlock.with_user_facing_limitations.by_severity if display_blocks?
  18. end
  19. def terms; end
  20. helper_method :display_blocks?
  21. helper_method :display_blocks_rationale?
  22. helper_method :public_fetch_mode?
  23. helper_method :new_user
  24. private
  25. def require_open_federation!
  26. not_found if whitelist_mode?
  27. end
  28. def display_blocks?
  29. Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
  30. end
  31. def display_blocks_rationale?
  32. Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?)
  33. end
  34. def new_user
  35. User.new.tap do |user|
  36. user.build_account
  37. user.build_invite_request
  38. end
  39. end
  40. def set_instance_presenter
  41. @instance_presenter = InstancePresenter.new
  42. end
  43. def set_body_classes
  44. @hide_navbar = true
  45. end
  46. def set_expires_in
  47. expires_in 0, public: true
  48. end
  49. end