/api/v1/accounts/relationships Return an empty array if no id in params
This copies Mastodon API behaviour & fixes Mastalab app.
This commit is contained in:
parent
e1c40b8ca2
commit
e42f2efae4
@ -443,6 +443,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
render(conn, AccountView, "relationships.json", %{user: user, targets: targets})
|
render(conn, AccountView, "relationships.json", %{user: user, targets: targets})
|
||||||
end
|
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
|
def update_media(%{assigns: %{user: _}} = conn, data) do
|
||||||
with %Object{} = object <- Repo.get(Object, data["id"]),
|
with %Object{} = object <- Repo.get(Object, data["id"]),
|
||||||
true <- is_binary(data["description"]),
|
true <- is_binary(data["description"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user