The code powering m.abunchtell.com https://m.abunchtell.com
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

38 строки
760 B

  1. # frozen_string_literal: true
  2. class RemoteFollowController < ApplicationController
  3. layout 'public'
  4. before_action :set_account
  5. before_action :gone, if: -> { @account.suspended? }
  6. def new
  7. @remote_follow = RemoteFollow.new(session_params)
  8. end
  9. def create
  10. @remote_follow = RemoteFollow.new(resource_params)
  11. if @remote_follow.valid?
  12. session[:remote_follow] = @remote_follow.acct
  13. redirect_to @remote_follow.subscribe_address_for(@account)
  14. else
  15. render :new
  16. end
  17. end
  18. private
  19. def resource_params
  20. params.require(:remote_follow).permit(:acct)
  21. end
  22. def session_params
  23. { acct: session[:remote_follow] }
  24. end
  25. def set_account
  26. @account = Account.find_local!(params[:account_username])
  27. end
  28. end