mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-15 19:33:32 +00:00
Limit returned followees/followers by API to 40 for now
This commit is contained in:
parent
f10feb2e70
commit
fa1cc2d05a
|
@ -14,12 +14,12 @@ class Api::V1::AccountsController < ApiController
|
||||||
end
|
end
|
||||||
|
|
||||||
def following
|
def following
|
||||||
@accounts = @account.following
|
@accounts = @account.following.limit(40)
|
||||||
render action: :index
|
render action: :index
|
||||||
end
|
end
|
||||||
|
|
||||||
def followers
|
def followers
|
||||||
@accounts = @account.followers
|
@accounts = @account.followers.limit(40)
|
||||||
render action: :index
|
render action: :index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ class Account < ApplicationRecord
|
||||||
def common_followers_with(other_account)
|
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)
|
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)
|
ids = results['data'].map(&:first)
|
||||||
accounts = Account.where(id: ids).with_counters.map { |a| [a.id, a] }.to_h
|
accounts = Account.where(id: ids).with_counters.limit(20).map { |a| [a.id, a] }.to_h
|
||||||
ids.map { |id| accounts[id] }.compact
|
ids.map { |id| accounts[id] }.compact
|
||||||
rescue Neography::NeographyError, Excon::Error::Socket
|
rescue Neography::NeographyError, Excon::Error::Socket
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Reference in a new issue