闭社主体 forked from https://github.com/tootsuite/mastodon
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.

41 lines
816 B

  1. # frozen_string_literal: true
  2. class RemoteFollowController < ApplicationController
  3. include AccountOwnedConcern
  4. layout 'modal'
  5. before_action :set_body_classes
  6. skip_before_action :require_functional!
  7. def new
  8. @remote_follow = RemoteFollow.new(session_params)
  9. end
  10. def create
  11. @remote_follow = RemoteFollow.new(resource_params)
  12. if @remote_follow.valid?
  13. session[:remote_follow] = @remote_follow.acct
  14. redirect_to @remote_follow.subscribe_address_for(@account)
  15. else
  16. render :new
  17. end
  18. end
  19. private
  20. def resource_params
  21. params.require(:remote_follow).permit(:acct)
  22. end
  23. def session_params
  24. { acct: session[:remote_follow] || current_account&.username }
  25. end
  26. def set_body_classes
  27. @body_classes = 'modal-layout'
  28. @hide_header = true
  29. end
  30. end