logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

shares_controller.rb (938B)


  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. text = [params[:title], params[:text], params[:url]].compact.join(' ')
  13. {
  14. settings: Web::Setting.find_by(user: current_user)&.data || {},
  15. push_subscription: current_account.user.web_push_subscription(current_session),
  16. current_account: current_account,
  17. token: current_session.token,
  18. admin: Account.find_local(Setting.site_contact_username),
  19. text: text,
  20. }
  21. end
  22. def set_body_classes
  23. @body_classes = 'modal-layout compose-standalone'
  24. end
  25. end