Add ability to use remote follow function on other sites
This commit is contained in:
parent
8b94d283fb
commit
d7dc84439c
18 changed files with 166 additions and 32 deletions
24
app/controllers/authorize_follow_controller.rb
Normal file
24
app/controllers/authorize_follow_controller.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AuthorizeFollowController < ApplicationController
|
||||
layout 'public'
|
||||
|
||||
before_action :authenticate_user!
|
||||
|
||||
def new
|
||||
@account = FollowRemoteAccountService.new.call(params[:acct])
|
||||
render :error if @account.nil?
|
||||
end
|
||||
|
||||
def create
|
||||
@account = FollowService.new.call(current_account, params[:acct]).try(:target_account)
|
||||
|
||||
if @account.nil?
|
||||
render :error
|
||||
else
|
||||
redirect_to web_url("accounts/#{@account.id}")
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermitted
|
||||
render :error
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue