Support remote follow request providing URL instead of acct
This commit is contained in:
parent
d7dc84439c
commit
8724094ed0
3 changed files with 24 additions and 2 deletions
|
@ -337,6 +337,10 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
|
|
@ -6,7 +6,14 @@ class AuthorizeFollowController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@account = FollowRemoteAccountService.new.call(params[:acct])
|
uri = Addressable::URI.parse(params[:acct])
|
||||||
|
|
||||||
|
if uri.path && %w(http https).include?(uri.scheme)
|
||||||
|
set_account_from_url
|
||||||
|
else
|
||||||
|
set_account_from_acct
|
||||||
|
end
|
||||||
|
|
||||||
render :error if @account.nil?
|
render :error if @account.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,4 +28,14 @@ class AuthorizeFollowController < ApplicationController
|
||||||
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermitted
|
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermitted
|
||||||
render :error
|
render :error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_account_from_url
|
||||||
|
@account = FetchRemoteAccountService.new.call(params[:acct])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_account_from_acct
|
||||||
|
@account = FollowRemoteAccountService.new.call(params[:acct])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
%strong= display_name(@account)
|
%strong= display_name(@account)
|
||||||
%span= "@#{@account.acct}"
|
%span= "@#{@account.acct}"
|
||||||
|
|
||||||
.account__header__content= Formatter.instance.simplified_format(@account)
|
- unless @account.note.blank?
|
||||||
|
.account__header__content= Formatter.instance.simplified_format(@account)
|
||||||
|
|
||||||
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
|
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
|
||||||
= hidden_field_tag :acct, @account.acct
|
= hidden_field_tag :acct, @account.acct
|
||||||
|
|
Loading…
Reference in a new issue