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.

47 lines
1.0 KiB

  1. # frozen_string_literal: true
  2. class AboutController < ApplicationController
  3. before_action :set_pack
  4. before_action :set_body_classes
  5. before_action :set_instance_presenter, only: [:show, :more, :terms]
  6. def show
  7. serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
  8. @initial_state_json = serializable_resource.to_json
  9. end
  10. def more
  11. render layout: 'public'
  12. end
  13. def terms
  14. render layout: 'public'
  15. end
  16. private
  17. def new_user
  18. User.new.tap(&:build_account)
  19. end
  20. helper_method :new_user
  21. def set_pack
  22. use_pack action_name == 'show' ? 'about' : 'common'
  23. end
  24. def set_instance_presenter
  25. @instance_presenter = InstancePresenter.new
  26. end
  27. def set_body_classes
  28. @body_classes = 'with-modals'
  29. end
  30. def initial_state_params
  31. {
  32. settings: { known_fediverse: Setting.show_known_fediverse_at_about_page },
  33. token: current_session&.token,
  34. }
  35. end
  36. end