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.

69 lines
1.7 KiB

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