From e42f2efae45923739b537cf35f3875578b181d37 Mon Sep 17 00:00:00 2001 From: href Date: Wed, 7 Nov 2018 16:27:07 +0100 Subject: [PATCH] /api/v1/accounts/relationships Return an empty array if no id in params This copies Mastodon API behaviour & fixes Mastalab app. --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 5cb007740..af4cf2b71 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -443,6 +443,12 @@ def relationships(%{assigns: %{user: user}} = conn, %{"id" => id}) do render(conn, AccountView, "relationships.json", %{user: user, targets: targets}) end + # Instead of returning a 400 when no "id" params is present, Mastodon returns an empty array. + def relationships(%{assigns: %{user: user}} = conn, _) do + conn + |> json([]) + end + def update_media(%{assigns: %{user: _}} = conn, data) do with %Object{} = object <- Repo.get(Object, data["id"]), true <- is_binary(data["description"]),