logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: a764e6fdd436e6014ded4baf8ec402d25107f987
parent: e1c40b8ca288fe689cd78a96b34276089df3babe
Author: lambda <pleromagit@rogerbraun.net>
Date:   Wed,  7 Nov 2018 16:04:01 +0000

Merge branch 'mastodon-api-relationships-without-id-param' into 'develop'

Mastodon API: relationships without id param

See merge request pleroma/pleroma!432

Diffstat:

Mlib/pleroma/web/mastodon_api/mastodon_api_controller.ex6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -443,6 +443,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController 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"]),