diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-30 15:08:36 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-30 15:08:36 +0100 |
commit | f10feb2e701ec2c07252be4dcc3bec44973650f9 (patch) | |
tree | 49de773adc15b95e4f6695530d3aeb82c72dda9a /app | |
parent | e8ff4c8e56650bf061c63a7da3d84b742e618b6a (diff) |
Fix common followers API
Diffstat (limited to 'app')
-rw-r--r-- | app/models/account.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 2e1f7a448..49af7962c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -125,7 +125,7 @@ class Account < ApplicationRecord def common_followers_with(other_account) results = Neography::Rest.new.execute_query('MATCH (a {account_id: {a_id}})-[:follows]->(b)-[:follows]->(c {account_id: {c_id}}) RETURN b.account_id', a_id: id, c_id: other_account.id) ids = results['data'].map(&:first) - accounts = self.where(id: ids).with_counters.map { |a| [a.id, a] }.to_h + accounts = Account.where(id: ids).with_counters.map { |a| [a.id, a] }.to_h ids.map { |id| accounts[id] }.compact rescue Neography::NeographyError, Excon::Error::Socket [] |