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.

30 lines
859 B

  1. # frozen_string_literal: true
  2. class SharesController < ApplicationController
  3. layout 'modal'
  4. before_action :authenticate_user!
  5. before_action :set_body_classes
  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. private
  11. def initial_state_params
  12. {
  13. settings: Web::Setting.find_by(user: current_user)&.data || {},
  14. push_subscription: current_account.user.web_push_subscription(current_session),
  15. current_account: current_account,
  16. token: current_session.token,
  17. admin: Account.find_local(Setting.site_contact_username),
  18. text: params[:text],
  19. }
  20. end
  21. def set_body_classes
  22. @body_classes = 'compose-standalone'
  23. end
  24. end