]> cat aescling's git repositories - mastodon.git/commitdiff
Exclude nil from relationships array (#6427)
authorabcang <abcang1015@gmail.com>
Sun, 4 Feb 2018 11:32:10 +0000 (20:32 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 4 Feb 2018 11:32:10 +0000 (12:32 +0100)
app/controllers/api/v1/accounts/relationships_controller.rb

index 91a942d7530fb5b466fe9b3c6def1cbad5acb42c..6cc3da498519bf3fbf1b183d23967bbc7b7ebc5b 100644 (file)
@@ -10,7 +10,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController
     accounts = Account.where(id: account_ids).select('id')
     # .where doesn't guarantee that our results are in the same order
     # we requested them, so return the "right" order to the requestor.
-    @accounts = accounts.index_by(&:id).values_at(*account_ids)
+    @accounts = accounts.index_by(&:id).values_at(*account_ids).compact
     render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
   end