]> cat aescling's git repositories - mastodon.git/blob - app/controllers/remote_follow_controller.rb
Merge branch 'master' into glitch-soc/merge-upstream
[mastodon.git] / app / controllers / remote_follow_controller.rb
1 # frozen_string_literal: true
2
3 class RemoteFollowController < ApplicationController
4 layout 'modal'
5
6 before_action :set_account
7 before_action :set_pack
8 before_action :gone, if: :suspended_account?
9 before_action :set_body_classes
10
11 def new
12 @remote_follow = RemoteFollow.new(session_params)
13 end
14
15 def create
16 @remote_follow = RemoteFollow.new(resource_params)
17
18 if @remote_follow.valid?
19 session[:remote_follow] = @remote_follow.acct
20 redirect_to @remote_follow.subscribe_address_for(@account)
21 else
22 render :new
23 end
24 end
25
26 private
27
28 def resource_params
29 params.require(:remote_follow).permit(:acct)
30 end
31
32 def session_params
33 { acct: session[:remote_follow] }
34 end
35
36 def set_pack
37 use_pack 'modal'
38 end
39
40 def set_account
41 @account = Account.find_local!(params[:account_username])
42 end
43
44 def suspended_account?
45 @account.suspended?
46 end
47
48 def set_body_classes
49 @body_classes = 'modal-layout'
50 @hide_header = true
51 end
52 end
This page took 0.093998 seconds and 4 git commands to generate.