Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote following success page #4129

Merged
merged 4 commits into from Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/authorize_follows_controller.rb
Expand Up @@ -15,7 +15,7 @@ def create
if @account.nil?
render :error
else
redirect_to web_url("accounts/#{@account.id}")
render :success
end
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
render :error
Expand Down
9 changes: 9 additions & 0 deletions app/javascript/styles/forms.scss
Expand Up @@ -375,3 +375,12 @@ code {
width: 50%;
}
}

.post-follow-actions {
text-align: center;
color: $ui-primary-color;

div {
margin-bottom: 4px;
}
}
16 changes: 16 additions & 0 deletions app/views/authorize_follows/success.html.haml
@@ -0,0 +1,16 @@
- content_for :page_title do
= t('authorize_follow.title', acct: @account.acct)

.form-container
.follow-prompt
- if @account.locked?
%h2= t('authorize_follow.follow_request_html', self: current_account.username)
- else
%h2= t('authorize_follow.following_html', self: current_account.username)

= render 'card', account: @account

.post-follow-actions
%div= link_to t('authorize_follow.post_follow.web'), web_url("accounts/#{@account.id}"), 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')
6 changes: 6 additions & 0 deletions config/locales/en.yml
Expand Up @@ -218,6 +218,12 @@ en:
authorize_follow:
error: Unfortunately, there was an error looking up the remote account
follow: Follow
following_html: 'Success! You (<strong>%{self}</strong>) are now following:'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably not necessary to specify self in these two strings because the user just clicked from a page that already did that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to keep the two pages looking similar in style, but now that I think about it, you're probably right.

follow_request_html: 'You (<strong>%{self}</strong>) have sent a follow request to:'
post_follow:
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}
datetime:
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/authorize_follows_controller_spec.rb
Expand Up @@ -94,7 +94,7 @@
end

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)
Expand All @@ -103,7 +103,7 @@
post :create, params: { acct: 'acct:user@hostname' }

expect(service).to have_received(:call).with(account, 'user@hostname')
expect(response).to redirect_to(web_url('accounts/123'))
expect(response).to render_template(:success)
end
end
end
Expand Down