commit: 8b9fe0c7a167173b6ad2c735e30a60c55840f26d
parent: ab85fef07648604577a9bf21b9d3e1d78e0fa07f
Author: kaniini <nenolod@gmail.com>
Date: Thu, 23 Aug 2018 20:56:43 +0000
Merge branch 'fix/suggestions-api-error-handling' into 'develop'
Better error handling in /api/v1/suggestions
See merge request pleroma/pleroma!287
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -1116,7 +1116,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
data2 =
Enum.slice(data, 0, 40)
|> Enum.map(fn x ->
- Map.put(x, "id", User.get_or_fetch(x["acct"]).id)
+ Map.put(
+ x,
+ "id",
+ case User.get_or_fetch(x["acct"]) do
+ %{id: id} -> id
+ _ -> 0
+ end
+ )
end)
conn