1
0

about_controller.rb 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # frozen_string_literal: true
  2. class AboutController < ApplicationController
  3. before_action :set_body_classes
  4. before_action :set_instance_presenter, only: [:show, :more, :terms]
  5. def show
  6. serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
  7. @initial_state_json = serializable_resource.to_json
  8. end
  9. def more
  10. render layout: 'public'
  11. end
  12. def terms
  13. render layout: 'public'
  14. end
  15. private
  16. def new_user
  17. User.new.tap(&:build_account)
  18. end
  19. helper_method :new_user
  20. def set_instance_presenter
  21. @instance_presenter = InstancePresenter.new
  22. end
  23. def set_body_classes
  24. @body_classes = 'with-modals'
  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