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.

43 lines
967 B

  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; end
  11. def terms; end
  12. private
  13. def new_user
  14. User.new.tap(&:build_account)
  15. end
  16. helper_method :new_user
  17. def set_pack
  18. use_pack action_name == 'show' ? 'about' : 'common'
  19. end
  20. def set_instance_presenter
  21. @instance_presenter = InstancePresenter.new
  22. end
  23. def set_body_classes
  24. @body_classes = 'about-body'
  25. end
  26. def initial_state_params
  27. {
  28. settings: { known_fediverse: Setting.show_known_fediverse_at_about_page },
  29. token: current_session&.token,
  30. }
  31. end
  32. end