Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
e42f2efa
Verified
Commit
e42f2efa
authored
Nov 07, 2018
by
href
Browse files
/api/v1/accounts/relationships Return an empty array if no id in params
This copies Mastodon API behaviour & fixes Mastalab app.
parent
e1c40b8c
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
e42f2efa
...
...
@@ -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"
]),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment