The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

65 lines
1.6 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. skip_before_action :require_functional!, only: [:more, :terms]
  9. def show; end
  10. def more
  11. flash.now[:notice] = I18n.t('about.instance_actor_flash') if params[:instance_actor]
  12. toc_generator = TOCGenerator.new(@instance_presenter.site_extended_description)
  13. @contents = toc_generator.html
  14. @table_of_contents = toc_generator.toc
  15. @blocks = DomainBlock.with_user_facing_limitations.by_severity if display_blocks?
  16. end
  17. def terms; end
  18. helper_method :display_blocks?
  19. helper_method :display_blocks_rationale?
  20. helper_method :public_fetch_mode?
  21. helper_method :new_user
  22. private
  23. def require_open_federation!
  24. not_found if whitelist_mode?
  25. end
  26. def display_blocks?
  27. Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
  28. end
  29. def display_blocks_rationale?
  30. Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?)
  31. end
  32. def new_user
  33. User.new.tap do |user|
  34. user.build_account
  35. user.build_invite_request
  36. end
  37. end
  38. def set_instance_presenter
  39. @instance_presenter = InstancePresenter.new
  40. end
  41. def set_body_classes
  42. @hide_navbar = true
  43. end
  44. def set_expires_in
  45. expires_in 0, public: true
  46. end
  47. end