FollowService.new.call(current_user.account, @account.acct, reblogs_arg)
- options = @account.locked? ? {} : { following_map: reblogs_arg, requested_map: { @account.id => false } }
+ options = @account.locked? ? {} : { following_map: { @account.id => reblogs_arg }, requested_map: { @account.id => false } }
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(options)
end
def follow!(other_account, reblogs: nil)
reblogs = true if reblogs.nil?
rel = active_relationships.create_with(show_reblogs: reblogs).find_or_create_by!(target_account: other_account)
- if rel.show_reblogs != reblogs
- rel.show_reblogs = reblogs
- rel.save!
- end
+ rel.update!(show_reblogs: reblogs)
rel
end
# Follow a remote user, notify remote user about the follow
# @param [Account] source_account From which to follow
# @param [String, Account] uri User URI to follow in the form of username@domain (or account record)
+ # @param [true, false, nil] reblogs Whether or not to show reblogs, defaults to true
def call(source_account, uri, reblogs: nil)
reblogs = true if reblogs.nil?
target_account = uri.is_a?(Account) ? uri : ResolveRemoteAccountService.new.call(uri)
# This isn't managed by a method in AccountInteractions, so we modify it
# ourselves if necessary.
req = follow_requests.find_by(target_account: other_account)
- if req.show_reblogs != reblogs
- req.show_reblogs = reblogs
- req.save!
- end
+ req.update!(show_reblogs: reblogs)
return
end