Commit 7a889a8e authored by STJrInuyasha's avatar STJrInuyasha Committed by Eugen Rochko

Remote following success page (#4129)

* Added a success page to remote following
Includes follow-through links to web (the old redirect target) and back to the remote user's profile

* Use in spec instead of a fake with only id
(fixes spec)

* Fabricate(:account) over

* Remove self from the success text
(and all HTML with it)
parent d081d4a4
......@@ -15,7 +15,7 @@ class AuthorizeFollowsController < ApplicationController
if @account.nil?
render :error
redirect_to web_url("accounts/#{}")
render :success
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
render :error
......@@ -375,3 +375,12 @@ code {
width: 50%;
.post-follow-actions {
text-align: center;
color: $ui-primary-color;
div {
margin-bottom: 4px;
- content_for :page_title do
= t('authorize_follow.title', acct: @account.acct)
- if @account.locked?
%h2= t('authorize_follow.follow_request')
- else
%h2= t('authorize_follow.following')
= render 'card', account: @account
%div= link_to t('authorize_follow.post_follow.web'), web_url("accounts/#{}"), class: 'button button--block'
%div= link_to t('authorize_follow.post_follow.return'), @account.url, class: 'button button--block'
%div= t('authorize_follow.post_follow.close')
......@@ -221,6 +221,12 @@ en:
error: Unfortunately, there was an error looking up the remote account
follow: Follow
following: 'Success! You are now following:'
follow_request: 'You have sent a follow request to:'
web: Go to web
return: Return to the user's profile
close: Or, you can just close this window.
prompt_html: 'You (<strong>%{self}</strong>) have requested to follow:'
title: Follow %{acct}
......@@ -94,7 +94,7 @@ describe AuthorizeFollowsController do
it 'follows account when found' do
target_account = double(id: '123')
target_account = Fabricate(:account)
result_account = double(target_account: target_account)
service = double
allow(FollowService).to receive(:new).and_return(service)
......@@ -103,7 +103,7 @@ describe AuthorizeFollowsController do
post :create, params: { acct: 'acct:[email protected]' }
expect(service).to have_received(:call).with(account, '[email protected]')
expect(response).to redirect_to(web_url('accounts/123'))
expect(response).to render_template(:success)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment