]> cat aescling's git repositories - mastodon.git/commitdiff
Fix suggestions fallback
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 15 Oct 2016 15:34:00 +0000 (17:34 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 15 Oct 2016 15:34:00 +0000 (17:34 +0200)
app/models/follow_suggestion.rb

index df1d77e6c31b500f73c4c4df62ec364f467da950..71927031823f081c247362e2b26d49820c48f916 100644 (file)
@@ -14,7 +14,7 @@ END
 
     results = neo.execute_query(query, id: for_account_id, limit: limit)
 
-    return fallback(for_account_id, limit) if results.empty?
+    return fallback(for_account_id, limit) if results.empty? || results['data'].empty?
 
     map_to_accounts(for_account_id, results)
   rescue Neography::NeographyError, Excon::Error::Socket => e
@@ -36,7 +36,7 @@ END
   end
 
   def self.map_to_accounts(for_account_id, results)
-    return [] if results.empty?
+    return [] if results.empty? || results['data'].empty?
 
     account_ids  = results['data'].map(&:first)
     blocked_ids  = Block.where(account_id: for_account_id).pluck(:target_account_id)