]> cat aescling's git repositories - mastodon.git/blob - app/controllers/remote_follow_controller.rb
Add a new preference to always hide all media (#8569)
[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 :gone, if: :suspended_account?
8 before_action :set_body_classes
9
10 def new
11 @remote_follow = RemoteFollow.new(session_params)
12 end
13
14 def create
15 @remote_follow = RemoteFollow.new(resource_params)
16
17 if @remote_follow.valid?
18 session[:remote_follow] = @remote_follow.acct
19 redirect_to @remote_follow.subscribe_address_for(@account)
20 else
21 render :new
22 end
23 end
24
25 private
26
27 def resource_params
28 params.require(:remote_follow).permit(:acct)
29 end
30
31 def session_params
32 { acct: session[:remote_follow] }
33 end
34
35 def set_account
36 @account = Account.find_local!(params[:account_username])
37 end
38
39 def suspended_account?
40 @account.suspended?
41 end
42
43 def set_body_classes
44 @body_classes = 'modal-layout'
45 @hide_header = true
46 end
47 end
This page took 0.081997 seconds and 4 git commands to generate.