about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-15 17:34:00 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-15 17:34:00 +0200
commitdb4671fd3fa36b2855f35bddcefd5573976144a6 (patch)
tree4f0b38334e41012da453f97ac9a464146b7e5e9b
parent6e0b3ddb0d14aaf7ea86efad8053966208c73b2c (diff)
Fix suggestions fallback
-rw-r--r--app/models/follow_suggestion.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/follow_suggestion.rb b/app/models/follow_suggestion.rb
index df1d77e6c..719270318 100644
--- a/app/models/follow_suggestion.rb
+++ b/app/models/follow_suggestion.rb
@@ -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)