projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e1c40b8
)
/api/v1/accounts/relationships Return an empty array if no id in params
author
href
<href@random.sh>
Wed, 7 Nov 2018 15:27:07 +0000
(16:27 +0100)
committer
href
<href@random.sh>
Wed, 7 Nov 2018 15:32:57 +0000
(16:32 +0100)
This copies Mastodon API behaviour & fixes Mastalab app.
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 5cb007740bcebc66129584a7db6f32c6f1dca114..af4cf2b712736dd0d1dcafe7561c2e28e591589d 100644
(file)
--- 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"]),