Commit 6209e5b8 authored by Eugen Rochko's avatar Eugen Rochko

Fix compat

parent a4532e27
...@@ -33,10 +33,12 @@ class FriendsController < ApplicationController ...@@ -33,10 +33,12 @@ class FriendsController < ApplicationController
_friends.each do |friend| _friends.each do |friend|
next if friend.relative_account_id.blank? || friend.following next if friend.relative_account_id.blank? || friend.following
relationship = current_user.mastodon_client.perform_request(:post, "/api/v1/accounts/#{friend.relative_account_id}/follow") begin
friend.following = relationship['following'] || relationship['requested'] relationship = current_user.mastodon_client.perform_request(:post, "/api/v1/accounts/#{friend.relative_account_id}/follow")
rescue HTTP::Error, OpenSSL::SSL::SSLError, Oj::ParseError friend.following = relationship['following'] || relationship['requested']
next rescue HTTP::Error, OpenSSL::SSL::SSLError, Oj::ParseError
next
end
end end
Rails.cache.write("#{current_user.id}/friends", _friends.map { |f| [f.id, f.relative_account_id, f.following] }) Rails.cache.write("#{current_user.id}/friends", _friends.map { |f| [f.id, f.relative_account_id, f.following] })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment