Fix misleading error when attempting to re-send a pending follow request (#13133)

Fixes #13131
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
ThibG 2020-02-24 21:19:19 +01:00 committed by GitHub
parent d91946ae13
commit cf4fe6caef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -18,14 +18,13 @@ class FollowService < BaseService
if source_account.following?(target_account) if source_account.following?(target_account)
# We're already following this account, but we'll call follow! again to # We're already following this account, but we'll call follow! again to
# make sure the reblogs status is set correctly. # make sure the reblogs status is set correctly.
source_account.follow!(target_account, reblogs: reblogs) return source_account.follow!(target_account, reblogs: reblogs)
return
elsif source_account.requested?(target_account) elsif source_account.requested?(target_account)
# This isn't managed by a method in AccountInteractions, so we modify it # This isn't managed by a method in AccountInteractions, so we modify it
# ourselves if necessary. # ourselves if necessary.
req = source_account.follow_requests.find_by(target_account: target_account) req = source_account.follow_requests.find_by(target_account: target_account)
req.update!(show_reblogs: reblogs) req.update!(show_reblogs: reblogs)
return return req
end end
ActivityTracker.increment('activity:interactions') ActivityTracker.increment('activity:interactions')

View File

@ -10,6 +10,12 @@
%strong %strong
= t('authorize_follow.already_following') = t('authorize_follow.already_following')
= render 'post_follow_actions'
- elsif current_account.requested?(@resource)
.flash-message
%strong
= t('authorize_follow.already_requested')
= render 'post_follow_actions' = render 'post_follow_actions'
- else - else
= form_tag authorize_interaction_path, method: :post, class: 'simple_form' do = form_tag authorize_interaction_path, method: :post, class: 'simple_form' do

View File

@ -661,6 +661,7 @@ en:
trouble_logging_in: Trouble logging in? trouble_logging_in: Trouble logging in?
authorize_follow: authorize_follow:
already_following: You are already following this account already_following: You are already following this account
already_requested: You have already sent a follow request to that account
error: Unfortunately, there was an error looking up the remote account error: Unfortunately, there was an error looking up the remote account
follow: Follow follow: Follow
follow_request: 'You have sent a follow request to:' follow_request: 'You have sent a follow request to:'