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

Mastodon API: relationships without id param

See merge request pleroma/pleroma!432
This commit is contained in:
lambda 2018-11-07 16:04:01 +00:00
commit a764e6fdd4
1 changed files with 6 additions and 0 deletions

View File

@ -443,6 +443,12 @@ def relationships(%{assigns: %{user: user}} = conn, %{"id" => id}) 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"]),